<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE DeriveFunctor #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- | Base LLVM Code Generation module</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Contains functions useful through out the code generator.</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.CmmToLlvm.Base</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmCmmDecl"><span class="hs-identifier">LlvmCmmDecl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmBasicBlock"><span class="hs-identifier">LlvmBasicBlock</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier">LiveGlobalRegs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmUnresData"><span class="hs-identifier">LlvmUnresData</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmData"><span class="hs-identifier">LlvmData</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#UnresLabel"><span class="hs-identifier">UnresLabel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#UnresStatic"><span class="hs-identifier">UnresStatic</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier">LlvmVersion</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmVersionSupported"><span class="hs-identifier">llvmVersionSupported</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#parseLlvmVersion"><span class="hs-identifier">parseLlvmVersion</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionLowerBound"><span class="hs-identifier">supportedLlvmVersionLowerBound</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionUpperBound"><span class="hs-identifier">supportedLlvmVersionUpperBound</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmVersionStr"><span class="hs-identifier">llvmVersionStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmVersionList"><span class="hs-identifier">llvmVersionList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier">LlvmM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#runLlvm"><span class="hs-identifier">runLlvm</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#liftStream"><span class="hs-identifier">liftStream</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#withClearVars"><span class="hs-identifier">withClearVars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#varLookup"><span class="hs-identifier">varLookup</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#varInsert"><span class="hs-identifier">varInsert</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#markStackReg"><span class="hs-identifier">markStackReg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#checkStackReg"><span class="hs-identifier">checkStackReg</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#funLookup"><span class="hs-identifier">funLookup</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#funInsert"><span class="hs-identifier">funInsert</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getLlvmVer"><span class="hs-identifier">getLlvmVer</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier">getDynFlags</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#dumpIfSetLlvm"><span class="hs-identifier">dumpIfSetLlvm</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#renderLlvm"><span class="hs-identifier">renderLlvm</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#markUsedVar"><span class="hs-identifier">markUsedVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getUsedVars"><span class="hs-identifier">getUsedVars</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#ghcInternalFunctions"><span class="hs-identifier">ghcInternalFunctions</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getPlatform"><span class="hs-identifier">getPlatform</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getLlvmOpts"><span class="hs-identifier">getLlvmOpts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getMetaUniqueId"><span class="hs-identifier">getMetaUniqueId</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#setUniqMeta"><span class="hs-identifier">setUniqMeta</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getUniqMeta"><span class="hs-identifier">getUniqMeta</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#cmmToLlvmType"><span class="hs-identifier">cmmToLlvmType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#widthToLlvmFloat"><span class="hs-identifier">widthToLlvmFloat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#widthToLlvmInt"><span class="hs-identifier">widthToLlvmInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunTy"><span class="hs-identifier">llvmFunTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunSig"><span class="hs-identifier">llvmFunSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunArgs"><span class="hs-identifier">llvmFunArgs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmStdFunAttrs"><span class="hs-identifier">llvmStdFunAttrs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunAlign"><span class="hs-identifier">llvmFunAlign</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmInfAlign"><span class="hs-identifier">llvmInfAlign</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmPtrBits"><span class="hs-identifier">llvmPtrBits</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#tysToParams"><span class="hs-identifier">tysToParams</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunSection"><span class="hs-identifier">llvmFunSection</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#padLiveArgs"><span class="hs-identifier">padLiveArgs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier">isFPR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#strCLabel_llvm"><span class="hs-identifier">strCLabel_llvm</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getGlobalPtr"><span class="hs-identifier">getGlobalPtr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#generateExternDecls"><span class="hs-identifier">generateExternDecls</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span>        </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#aliasify"><span class="hs-identifier">aliasify</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmDefLabel"><span class="hs-identifier">llvmDefLabel</span></a></span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span class="hs-cpp">#include &quot;ghcautoconf.h&quot;
</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html"><span class="hs-identifier">GHC.Utils.Panic</span></a></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Llvm.html"><span class="hs-identifier">GHC.Llvm</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Regs.html"><span class="hs-identifier">GHC.CmmToLlvm.Regs</span></a></span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html"><span class="hs-identifier">GHC.Cmm.CLabel</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Ppr.Expr.html"><span class="hs-identifier">GHC.Cmm.Ppr.Expr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Platform.Regs.html"><span class="hs-identifier">GHC.Platform.Regs</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Platform.Regs.html#activeStgRegs"><span class="hs-identifier">activeStgRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Regs.html#globalRegMaybe"><span class="hs-identifier">globalRegMaybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.html"><span class="hs-identifier">GHC.Cmm</span></a></span><span>              </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Cmm.Node.html#succ"><span class="hs-identifier">succ</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Utils.html"><span class="hs-identifier">GHC.Cmm.Utils</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Utils.html#regsOverlap"><span class="hs-identifier">regsOverlap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Outp</span></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html"><span class="hs-identifier">GHC.Types.Unique</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.BufHandle.html"><span class="hs-identifier">GHC.Utils.BufHandle</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Utils.BufHandle.html#BufHandle"><span class="hs-identifier">BufHandle</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html"><span class="hs-identifier">GHC.Types.Unique.Set</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.Data.Stream.html"><span class="hs-identifier">GHC.Data.Stream</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Stream</span></span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Maybe.html#fromJust"><span class="hs-identifier">fromJust</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#ap"><span class="hs-identifier">ap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier">isDigit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#sortBy"><span class="hs-identifier">sortBy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#groupBy"><span class="hs-identifier">groupBy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#intercalate"><span class="hs-identifier">intercalate</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Ord.html#"><span class="hs-identifier">Data.Ord</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Ord.html#comparing"><span class="hs-identifier">comparing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#"><span class="hs-identifier">Data.List.NonEmpty</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">NE</span></span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- * Some Data Types</span><span>
</span><span id="line-77"></span><span class="hs-comment">--</span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span class="hs-keyword">type</span><span> </span><span id="LlvmCmmDecl"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmCmmDecl"><span class="hs-identifier hs-var">LlvmCmmDecl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Cmm.html#GenCmmDecl"><span class="hs-identifier hs-type">GenCmmDecl</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmData"><span class="hs-identifier hs-type">LlvmData</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Cmm.html#RawCmmStatics"><span class="hs-identifier hs-type">RawCmmStatics</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#ListGraph"><span class="hs-identifier hs-type">ListGraph</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmStatement"><span class="hs-identifier hs-type">LlvmStatement</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-80"></span><span class="hs-keyword">type</span><span> </span><span id="LlvmBasicBlock"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmBasicBlock"><span class="hs-identifier hs-var">LlvmBasicBlock</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Cmm.html#GenBasicBlock"><span class="hs-identifier hs-type">GenBasicBlock</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Syntax.html#LlvmStatement"><span class="hs-identifier hs-type">LlvmStatement</span></a></span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span class="hs-comment">-- | Global registers live on proc entry</span><span>
</span><span id="line-83"></span><span class="hs-keyword">type</span><span> </span><span id="LiveGlobalRegs"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier hs-var">LiveGlobalRegs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span class="hs-comment">-- | Unresolved code.</span><span>
</span><span id="line-86"></span><span class="hs-comment">-- Of the form: (data label, data type, unresolved data)</span><span>
</span><span id="line-87"></span><span class="hs-keyword">type</span><span> </span><span id="LlvmUnresData"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmUnresData"><span class="hs-identifier hs-var">LlvmUnresData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.CLabel.html#CLabel"><span class="hs-identifier hs-type">CLabel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Cmm.html#Section"><span class="hs-identifier hs-type">Section</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#UnresStatic"><span class="hs-identifier hs-type">UnresStatic</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span class="hs-comment">-- | Top level LLVM Data (globals and type aliases)</span><span>
</span><span id="line-90"></span><span class="hs-keyword">type</span><span> </span><span id="LlvmData"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmData"><span class="hs-identifier hs-var">LlvmData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-type">LMGlobal</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-comment">-- | An unresolved Label.</span><span>
</span><span id="line-93"></span><span class="hs-comment">--</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- Labels are unresolved when we haven't yet determined if they are defined in</span><span>
</span><span id="line-95"></span><span class="hs-comment">-- the module we are currently compiling, or an external one.</span><span>
</span><span id="line-96"></span><span class="hs-keyword">type</span><span> </span><span id="UnresLabel"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#UnresLabel"><span class="hs-identifier hs-var">UnresLabel</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#CmmLit"><span class="hs-identifier hs-type">CmmLit</span></a></span><span>
</span><span id="line-97"></span><span class="hs-keyword">type</span><span> </span><span id="UnresStatic"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#UnresStatic"><span class="hs-identifier hs-var">UnresStatic</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#UnresLabel"><span class="hs-identifier hs-type">UnresLabel</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmStatic"><span class="hs-identifier hs-type">LlvmStatic</span></a></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- * Type translations</span><span>
</span><span id="line-101"></span><span class="hs-comment">--</span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span class="hs-comment">-- | Translate a basic CmmType to an LlvmType.</span><span>
</span><span id="line-104"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#cmmToLlvmType"><span class="hs-identifier hs-type">cmmToLlvmType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Type.html#CmmType"><span class="hs-identifier hs-type">CmmType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span>
</span><span id="line-105"></span><span id="cmmToLlvmType"><span class="annot"><span class="annottext">cmmToLlvmType :: CmmType -&gt; LlvmType
</span><a href="GHC.CmmToLlvm.Base.html#cmmToLlvmType"><span class="hs-identifier hs-var hs-var">cmmToLlvmType</span></a></span></span><span> </span><span id="local-6989586621681011624"><span class="annot"><span class="annottext">CmmType
</span><a href="#local-6989586621681011624"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CmmType -&gt; Bool
</span><a href="GHC.Cmm.Type.html#isVecType"><span class="hs-identifier hs-var">isVecType</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType
</span><a href="#local-6989586621681011624"><span class="hs-identifier hs-var">ty</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; LlvmType -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#LMVector"><span class="hs-identifier hs-var">LMVector</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmType -&gt; Int
</span><a href="GHC.Cmm.Type.html#vecLength"><span class="hs-identifier hs-var">vecLength</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType
</span><a href="#local-6989586621681011624"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmType -&gt; LlvmType
</span><a href="GHC.CmmToLlvm.Base.html#cmmToLlvmType"><span class="hs-identifier hs-var">cmmToLlvmType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmType -&gt; CmmType
</span><a href="GHC.Cmm.Type.html#vecElemType"><span class="hs-identifier hs-var">vecElemType</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType
</span><a href="#local-6989586621681011624"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CmmType -&gt; Bool
</span><a href="GHC.Cmm.Type.html#isFloatType"><span class="hs-identifier hs-var">isFloatType</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType
</span><a href="#local-6989586621681011624"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Width -&gt; LlvmType
</span><a href="GHC.CmmToLlvm.Base.html#widthToLlvmFloat"><span class="hs-identifier hs-var">widthToLlvmFloat</span></a></span><span> </span><span class="annot"><span class="annottext">(Width -&gt; LlvmType) -&gt; Width -&gt; LlvmType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType -&gt; Width
</span><a href="GHC.Cmm.Type.html#typeWidth"><span class="hs-identifier hs-var">typeWidth</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType
</span><a href="#local-6989586621681011624"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-107"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Width -&gt; LlvmType
</span><a href="GHC.CmmToLlvm.Base.html#widthToLlvmInt"><span class="hs-identifier hs-var">widthToLlvmInt</span></a></span><span>   </span><span class="annot"><span class="annottext">(Width -&gt; LlvmType) -&gt; Width -&gt; LlvmType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType -&gt; Width
</span><a href="GHC.Cmm.Type.html#typeWidth"><span class="hs-identifier hs-var">typeWidth</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType
</span><a href="#local-6989586621681011624"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span class="hs-comment">-- | Translate a Cmm Float Width to a LlvmType.</span><span>
</span><span id="line-110"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#widthToLlvmFloat"><span class="hs-identifier hs-type">widthToLlvmFloat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Type.html#Width"><span class="hs-identifier hs-type">Width</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span>
</span><span id="line-111"></span><span id="widthToLlvmFloat"><span class="annot"><span class="annottext">widthToLlvmFloat :: Width -&gt; LlvmType
</span><a href="GHC.CmmToLlvm.Base.html#widthToLlvmFloat"><span class="hs-identifier hs-var hs-var">widthToLlvmFloat</span></a></span></span><span> </span><span class="annot"><span class="annottext">Width
</span><a href="GHC.Cmm.Type.html#W32"><span class="hs-identifier hs-var">W32</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#LMFloat"><span class="hs-identifier hs-var">LMFloat</span></a></span><span>
</span><span id="line-112"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#widthToLlvmFloat"><span class="hs-identifier hs-var">widthToLlvmFloat</span></a></span><span> </span><span class="annot"><span class="annottext">Width
</span><a href="GHC.Cmm.Type.html#W64"><span class="hs-identifier hs-var">W64</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#LMDouble"><span class="hs-identifier hs-var">LMDouble</span></a></span><span>
</span><span id="line-113"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#widthToLlvmFloat"><span class="hs-identifier hs-var">widthToLlvmFloat</span></a></span><span> </span><span class="annot"><span class="annottext">Width
</span><a href="GHC.Cmm.Type.html#W128"><span class="hs-identifier hs-var">W128</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#LMFloat128"><span class="hs-identifier hs-var">LMFloat128</span></a></span><span>
</span><span id="line-114"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#widthToLlvmFloat"><span class="hs-identifier hs-var">widthToLlvmFloat</span></a></span><span> </span><span id="local-6989586621681011611"><span class="annot"><span class="annottext">Width
</span><a href="#local-6989586621681011611"><span class="hs-identifier hs-var">w</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; LlvmType
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; LlvmType) -&gt; String -&gt; LlvmType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;widthToLlvmFloat: Bad float size: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Width -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Width
</span><a href="#local-6989586621681011611"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span class="hs-comment">-- | Translate a Cmm Bit Width to a LlvmType.</span><span>
</span><span id="line-117"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#widthToLlvmInt"><span class="hs-identifier hs-type">widthToLlvmInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Type.html#Width"><span class="hs-identifier hs-type">Width</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span>
</span><span id="line-118"></span><span id="widthToLlvmInt"><span class="annot"><span class="annottext">widthToLlvmInt :: Width -&gt; LlvmType
</span><a href="GHC.CmmToLlvm.Base.html#widthToLlvmInt"><span class="hs-identifier hs-var hs-var">widthToLlvmInt</span></a></span></span><span> </span><span id="local-6989586621681011608"><span class="annot"><span class="annottext">Width
</span><a href="#local-6989586621681011608"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#LMInt"><span class="hs-identifier hs-var">LMInt</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; LlvmType) -&gt; Int -&gt; LlvmType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Width -&gt; Int
</span><a href="GHC.Cmm.Type.html#widthInBits"><span class="hs-identifier hs-var">widthInBits</span></a></span><span> </span><span class="annot"><span class="annottext">Width
</span><a href="#local-6989586621681011608"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span class="hs-comment">-- | GHC Call Convention for LLVM</span><span>
</span><span id="line-121"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmGhcCC"><span class="hs-identifier hs-type">llvmGhcCC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmCallConvention"><span class="hs-identifier hs-type">LlvmCallConvention</span></a></span><span>
</span><span id="line-122"></span><span id="llvmGhcCC"><span class="annot"><span class="annottext">llvmGhcCC :: Platform -&gt; LlvmCallConvention
</span><a href="GHC.CmmToLlvm.Base.html#llvmGhcCC"><span class="hs-identifier hs-var hs-var">llvmGhcCC</span></a></span></span><span> </span><span id="local-6989586621681011604"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011604"><span class="hs-identifier hs-var">platform</span></a></span></span><span>
</span><span id="line-123"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformUnregisterised"><span class="hs-identifier hs-var hs-var">platformUnregisterised</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011604"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmCallConvention
</span><a href="GHC.Llvm.Types.html#CC_Ccc"><span class="hs-identifier hs-var">CC_Ccc</span></a></span><span>
</span><span id="line-124"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmCallConvention
</span><a href="GHC.Llvm.Types.html#CC_Ghc"><span class="hs-identifier hs-var">CC_Ghc</span></a></span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="hs-comment">-- | Llvm Function type for Cmm function</span><span>
</span><span id="line-127"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunTy"><span class="hs-identifier hs-type">llvmFunTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier hs-type">LiveGlobalRegs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span>
</span><span id="line-128"></span><span id="llvmFunTy"><span class="annot"><span class="annottext">llvmFunTy :: LiveGlobalRegs -&gt; LlvmM LlvmType
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunTy"><span class="hs-identifier hs-var hs-var">llvmFunTy</span></a></span></span><span> </span><span id="local-6989586621681011600"><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011600"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmType -&gt; LlvmM LlvmType
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmType -&gt; LlvmM LlvmType)
-&gt; (LlvmFunctionDecl -&gt; LlvmType)
-&gt; LlvmFunctionDecl
-&gt; LlvmM LlvmType
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmFunctionDecl -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#LMFunction"><span class="hs-identifier hs-var">LMFunction</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmFunctionDecl -&gt; LlvmM LlvmType)
-&gt; LlvmM LlvmFunctionDecl -&gt; LlvmM LlvmType
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
-&gt; LMString -&gt; LlvmLinkageType -&gt; LlvmM LlvmFunctionDecl
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunSig%27"><span class="hs-identifier hs-var">llvmFunSig'</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011600"><span class="hs-identifier hs-var">live</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; LMString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;a&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="GHC.Llvm.Types.html#ExternallyVisible"><span class="hs-identifier hs-var">ExternallyVisible</span></a></span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="hs-comment">-- | Llvm Function signature</span><span>
</span><span id="line-131"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunSig"><span class="hs-identifier hs-type">llvmFunSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier hs-type">LiveGlobalRegs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>  </span><span class="annot"><a href="GHC.Cmm.CLabel.html#CLabel"><span class="hs-identifier hs-type">CLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmLinkageType"><span class="hs-identifier hs-type">LlvmLinkageType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmFunctionDecl"><span class="hs-identifier hs-type">LlvmFunctionDecl</span></a></span><span>
</span><span id="line-132"></span><span id="llvmFunSig"><span class="annot"><span class="annottext">llvmFunSig :: LiveGlobalRegs
-&gt; CLabel -&gt; LlvmLinkageType -&gt; LlvmM LlvmFunctionDecl
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunSig"><span class="hs-identifier hs-var hs-var">llvmFunSig</span></a></span></span><span> </span><span id="local-6989586621681011593"><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011593"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span id="local-6989586621681011592"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681011592"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681011591"><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011591"><span class="hs-identifier hs-var">link</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-133"></span><span>  </span><span id="local-6989586621681011590"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011590"><span class="hs-identifier hs-var">lbl'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CLabel -&gt; LlvmM LMString
</span><a href="GHC.CmmToLlvm.Base.html#strCLabel_llvm"><span class="hs-identifier hs-var">strCLabel_llvm</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681011592"><span class="hs-identifier hs-var">lbl</span></a></span><span>
</span><span id="line-134"></span><span>  </span><span class="annot"><span class="annottext">LiveGlobalRegs
-&gt; LMString -&gt; LlvmLinkageType -&gt; LlvmM LlvmFunctionDecl
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunSig%27"><span class="hs-identifier hs-var">llvmFunSig'</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011593"><span class="hs-identifier hs-var">live</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011590"><span class="hs-identifier hs-var">lbl'</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011591"><span class="hs-identifier hs-var">link</span></a></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunSig%27"><span class="hs-identifier hs-type">llvmFunSig'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier hs-type">LiveGlobalRegs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmLinkageType"><span class="hs-identifier hs-type">LlvmLinkageType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmFunctionDecl"><span class="hs-identifier hs-type">LlvmFunctionDecl</span></a></span><span>
</span><span id="line-137"></span><span id="llvmFunSig%27"><span class="annot"><span class="annottext">llvmFunSig' :: LiveGlobalRegs
-&gt; LMString -&gt; LlvmLinkageType -&gt; LlvmM LlvmFunctionDecl
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunSig%27"><span class="hs-identifier hs-var hs-var">llvmFunSig'</span></a></span></span><span> </span><span id="local-6989586621681011589"><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011589"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span id="local-6989586621681011588"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011588"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681011587"><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011587"><span class="hs-identifier hs-var">link</span></a></span></span><span>
</span><span id="line-138"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011586"><span class="annot"><span class="annottext">toParams :: LlvmType -&gt; (LlvmType, [LlvmParamAttr])
</span><a href="#local-6989586621681011586"><span class="hs-identifier hs-var hs-var">toParams</span></a></span></span><span> </span><span id="local-6989586621681011585"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011585"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">LlvmType -&gt; Bool
</span><a href="GHC.Llvm.Types.html#isPointer"><span class="hs-identifier hs-var">isPointer</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011585"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011585"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmParamAttr
</span><a href="GHC.Llvm.Types.html#NoAlias"><span class="hs-identifier hs-var">NoAlias</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmParamAttr
</span><a href="GHC.Llvm.Types.html#NoCapture"><span class="hs-identifier hs-var">NoCapture</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-139"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011585"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span>       </span><span id="local-6989586621681011581"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011581"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM Platform
</span><a href="GHC.CmmToLlvm.Base.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-141"></span><span>       </span><span class="annot"><span class="annottext">LlvmFunctionDecl -&gt; LlvmM LlvmFunctionDecl
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmFunctionDecl -&gt; LlvmM LlvmFunctionDecl)
-&gt; LlvmFunctionDecl -&gt; LlvmM LlvmFunctionDecl
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
-&gt; LlvmLinkageType
-&gt; LlvmCallConvention
-&gt; LlvmType
-&gt; LlvmParameterListType
-&gt; [(LlvmType, [LlvmParamAttr])]
-&gt; LMAlign
-&gt; LlvmFunctionDecl
</span><a href="GHC.Llvm.Types.html#LlvmFunctionDecl"><span class="hs-identifier hs-var">LlvmFunctionDecl</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011588"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011587"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; LlvmCallConvention
</span><a href="GHC.CmmToLlvm.Base.html#llvmGhcCC"><span class="hs-identifier hs-var">llvmGhcCC</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011581"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#LMVoid"><span class="hs-identifier hs-var">LMVoid</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmParameterListType
</span><a href="GHC.Llvm.Types.html#FixedArgs"><span class="hs-identifier hs-var">FixedArgs</span></a></span><span>
</span><span id="line-142"></span><span>                                 </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LlvmVar -&gt; (LlvmType, [LlvmParamAttr]))
-&gt; [LlvmVar] -&gt; [(LlvmType, [LlvmParamAttr])]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType -&gt; (LlvmType, [LlvmParamAttr])
</span><a href="#local-6989586621681011586"><span class="hs-identifier hs-var">toParams</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmType -&gt; (LlvmType, [LlvmParamAttr]))
-&gt; (LlvmVar -&gt; LlvmType) -&gt; LlvmVar -&gt; (LlvmType, [LlvmParamAttr])
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#getVarType"><span class="hs-identifier hs-var">getVarType</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; LiveGlobalRegs -&gt; [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunArgs"><span class="hs-identifier hs-var">llvmFunArgs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011581"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011589"><span class="hs-identifier hs-var">live</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span>                                 </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; LMAlign
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunAlign"><span class="hs-identifier hs-var">llvmFunAlign</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011581"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-comment">-- | Alignment to use for functions</span><span>
</span><span id="line-146"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunAlign"><span class="hs-identifier hs-type">llvmFunAlign</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMAlign"><span class="hs-identifier hs-type">LMAlign</span></a></span><span>
</span><span id="line-147"></span><span id="llvmFunAlign"><span class="annot"><span class="annottext">llvmFunAlign :: Platform -&gt; LMAlign
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunAlign"><span class="hs-identifier hs-var hs-var">llvmFunAlign</span></a></span></span><span> </span><span id="local-6989586621681011576"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011576"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; LMAlign
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Int
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformWordSizeInBytes"><span class="hs-identifier hs-var">platformWordSizeInBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011576"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span class="hs-comment">-- | Alignment to use for into tables</span><span>
</span><span id="line-150"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmInfAlign"><span class="hs-identifier hs-type">llvmInfAlign</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMAlign"><span class="hs-identifier hs-type">LMAlign</span></a></span><span>
</span><span id="line-151"></span><span id="llvmInfAlign"><span class="annot"><span class="annottext">llvmInfAlign :: Platform -&gt; LMAlign
</span><a href="GHC.CmmToLlvm.Base.html#llvmInfAlign"><span class="hs-identifier hs-var hs-var">llvmInfAlign</span></a></span></span><span> </span><span id="local-6989586621681011574"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011574"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; LMAlign
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Int
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformWordSizeInBytes"><span class="hs-identifier hs-var">platformWordSizeInBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011574"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-comment">-- | Section to use for a function</span><span>
</span><span id="line-154"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunSection"><span class="hs-identifier hs-type">llvmFunSection</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmOpts"><span class="hs-identifier hs-type">LlvmOpts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMSection"><span class="hs-identifier hs-type">LMSection</span></a></span><span>
</span><span id="line-155"></span><span id="llvmFunSection"><span class="annot"><span class="annottext">llvmFunSection :: LlvmOpts -&gt; LMString -&gt; LMSection
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunSection"><span class="hs-identifier hs-var hs-var">llvmFunSection</span></a></span></span><span> </span><span id="local-6989586621681011573"><span class="annot"><span class="annottext">LlvmOpts
</span><a href="#local-6989586621681011573"><span class="hs-identifier hs-var">opts</span></a></span></span><span> </span><span id="local-6989586621681011572"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011572"><span class="hs-identifier hs-var">lbl</span></a></span></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">LlvmOpts -&gt; Bool
</span><a href="GHC.Llvm.Types.html#llvmOptsSplitSections"><span class="hs-identifier hs-var hs-var">llvmOptsSplitSections</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmOpts
</span><a href="#local-6989586621681011573"><span class="hs-identifier hs-var">opts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LMSection
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LMString] -&gt; LMString
</span><a href="GHC.Data.FastString.html#concatFS"><span class="hs-identifier hs-var">concatFS</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; LMString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.text.&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011572"><span class="hs-identifier hs-var">lbl</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-157"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMSection
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span class="hs-comment">-- | A Function's arguments</span><span>
</span><span id="line-160"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmFunArgs"><span class="hs-identifier hs-type">llvmFunArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier hs-type">LiveGlobalRegs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmVar"><span class="hs-identifier hs-type">LlvmVar</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-161"></span><span id="llvmFunArgs"><span class="annot"><span class="annottext">llvmFunArgs :: Platform -&gt; LiveGlobalRegs -&gt; [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#llvmFunArgs"><span class="hs-identifier hs-var hs-var">llvmFunArgs</span></a></span></span><span> </span><span id="local-6989586621681011569"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011569"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span id="local-6989586621681011568"><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011568"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-162"></span><span>    </span><span class="annot"><span class="annottext">(GlobalReg -&gt; LlvmVar) -&gt; LiveGlobalRegs -&gt; [LlvmVar]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; GlobalReg -&gt; LlvmVar
</span><a href="GHC.CmmToLlvm.Regs.html#lmGlobalRegArg"><span class="hs-identifier hs-var">lmGlobalRegArg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011569"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GlobalReg -&gt; Bool) -&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Bool
</span><a href="#local-6989586621681011566"><span class="hs-identifier hs-var">isPassed</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011565"><span class="hs-identifier hs-var">allRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681011565"><span class="annot"><span class="annottext">allRegs :: LiveGlobalRegs
</span><a href="#local-6989586621681011565"><span class="hs-identifier hs-var hs-var">allRegs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; LiveGlobalRegs
</span><a href="GHC.Platform.Regs.html#activeStgRegs"><span class="hs-identifier hs-var">activeStgRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011569"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-164"></span><span>          </span><span id="local-6989586621681011564"><span class="annot"><span class="annottext">paddingRegs :: LiveGlobalRegs
</span><a href="#local-6989586621681011564"><span class="hs-identifier hs-var hs-var">paddingRegs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#padLiveArgs"><span class="hs-identifier hs-var">padLiveArgs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011569"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011568"><span class="hs-identifier hs-var">live</span></a></span><span>
</span><span id="line-165"></span><span>          </span><span id="local-6989586621681011557"><span class="annot"><span class="annottext">isLive :: GlobalReg -&gt; Bool
</span><a href="#local-6989586621681011557"><span class="hs-identifier hs-var hs-var">isLive</span></a></span></span><span> </span><span id="local-6989586621681011556"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011556"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011556"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; LiveGlobalRegs -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Regs.html#alwaysLive"><span class="hs-identifier hs-var">alwaysLive</span></a></span><span>
</span><span id="line-166"></span><span>                     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011556"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; LiveGlobalRegs -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011568"><span class="hs-identifier hs-var">live</span></a></span><span>
</span><span id="line-167"></span><span>                     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011556"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; LiveGlobalRegs -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011564"><span class="hs-identifier hs-var">paddingRegs</span></a></span><span>
</span><span id="line-168"></span><span>          </span><span id="local-6989586621681011566"><span class="annot"><span class="annottext">isPassed :: GlobalReg -&gt; Bool
</span><a href="#local-6989586621681011566"><span class="hs-identifier hs-var hs-var">isPassed</span></a></span></span><span> </span><span id="local-6989586621681011552"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011552"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalReg -&gt; Bool
</span><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var">isFPR</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011552"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Bool
</span><a href="#local-6989586621681011557"><span class="hs-identifier hs-var">isLive</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011552"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span>
</span><span id="line-171"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-type">isFPR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-172"></span><span id="isFPR"><span class="annot"><span class="annottext">isFPR :: GlobalReg -&gt; Bool
</span><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var hs-var">isFPR</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#FloatReg"><span class="hs-identifier hs-type">FloatReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-173"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var">isFPR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#DoubleReg"><span class="hs-identifier hs-type">DoubleReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-174"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var">isFPR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#XmmReg"><span class="hs-identifier hs-type">XmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-175"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var">isFPR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#YmmReg"><span class="hs-identifier hs-type">YmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-176"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var">isFPR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#ZmmReg"><span class="hs-identifier hs-type">ZmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-177"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var">isFPR</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span class="hs-comment">-- | Return a list of &quot;padding&quot; registers for LLVM function calls.</span><span>
</span><span id="line-180"></span><span class="hs-comment">--</span><span>
</span><span id="line-181"></span><span class="hs-comment">-- When we generate LLVM function signatures, we can't just make any register</span><span>
</span><span id="line-182"></span><span class="hs-comment">-- alive on function entry. Instead, we need to insert fake arguments of the</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- same register class until we are sure that one of them is mapped to the</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- register we want alive. E.g. to ensure that F5 is alive, we may need to</span><span>
</span><span id="line-185"></span><span class="hs-comment">-- insert fake arguments mapped to F1, F2, F3 and F4.</span><span>
</span><span id="line-186"></span><span class="hs-comment">--</span><span>
</span><span id="line-187"></span><span class="hs-comment">-- Invariant: Cmm FPR regs with number &quot;n&quot; maps to real registers with number</span><span>
</span><span id="line-188"></span><span class="hs-comment">-- &quot;n&quot; If the calling convention uses registers in a different order or if the</span><span>
</span><span id="line-189"></span><span class="hs-comment">-- invariant doesn't hold, this code probably won't be correct.</span><span>
</span><span id="line-190"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#padLiveArgs"><span class="hs-identifier hs-type">padLiveArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier hs-type">LiveGlobalRegs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LiveGlobalRegs"><span class="hs-identifier hs-type">LiveGlobalRegs</span></a></span><span>
</span><span id="line-191"></span><span id="padLiveArgs"><span class="annot"><span class="annottext">padLiveArgs :: Platform -&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#padLiveArgs"><span class="hs-identifier hs-var hs-var">padLiveArgs</span></a></span></span><span> </span><span id="local-6989586621681011545"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011545"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span id="local-6989586621681011544"><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011544"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-192"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformUnregisterised"><span class="hs-identifier hs-var hs-var">platformUnregisterised</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011545"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-193"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- not using GHC's register convention for platform.</span><span>
</span><span id="line-194"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011543"><span class="hs-identifier hs-var">padded</span></a></span><span>
</span><span id="line-195"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-comment">----------------------------------</span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-comment">-- handle floating-point registers (FPR)</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>    </span><span id="local-6989586621681011542"><span class="annot"><span class="annottext">fprLive :: LiveGlobalRegs
</span><a href="#local-6989586621681011542"><span class="hs-identifier hs-var hs-var">fprLive</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GlobalReg -&gt; Bool) -&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Bool
</span><a href="GHC.CmmToLlvm.Base.html#isFPR"><span class="hs-identifier hs-var">isFPR</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011544"><span class="hs-identifier hs-var">live</span></a></span><span>  </span><span class="hs-comment">-- real live FPR registers</span><span>
</span><span id="line-200"></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-comment">-- we group live registers sharing the same classes, i.e. that use the same</span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-comment">-- set of real registers to be passed. E.g. FloatReg, DoubleReg and XmmReg</span><span>
</span><span id="line-203"></span><span>    </span><span class="hs-comment">-- all use the same real regs on X86-64 (XMM registers).</span><span>
</span><span id="line-204"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-205"></span><span>    </span><span id="local-6989586621681011541"><span class="annot"><span class="annottext">classes :: [LiveGlobalRegs]
</span><a href="#local-6989586621681011541"><span class="hs-identifier hs-var hs-var">classes</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GlobalReg -&gt; GlobalReg -&gt; Bool)
-&gt; LiveGlobalRegs -&gt; [LiveGlobalRegs]
forall a. (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; [[a]]
</span><a href="../../base/src/Data.OldList.html#groupBy"><span class="hs-identifier hs-var">groupBy</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; GlobalReg -&gt; Bool
</span><a href="#local-6989586621681011540"><span class="hs-identifier hs-var">sharesClass</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011542"><span class="hs-identifier hs-var">fprLive</span></a></span><span>
</span><span id="line-206"></span><span>    </span><span id="local-6989586621681011540"><span class="annot"><span class="annottext">sharesClass :: GlobalReg -&gt; GlobalReg -&gt; Bool
</span><a href="#local-6989586621681011540"><span class="hs-identifier hs-var hs-var">sharesClass</span></a></span></span><span> </span><span id="local-6989586621681011539"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011539"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681011538"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011538"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; CmmReg -&gt; CmmReg -&gt; Bool
</span><a href="GHC.Cmm.Utils.html#regsOverlap"><span class="hs-identifier hs-var">regsOverlap</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011545"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalReg -&gt; CmmReg
</span><a href="#local-6989586621681011537"><span class="hs-identifier hs-var">norm</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011539"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalReg -&gt; CmmReg
</span><a href="#local-6989586621681011537"><span class="hs-identifier hs-var">norm</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011538"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- check if mapped to overlapping registers</span><span>
</span><span id="line-207"></span><span>    </span><span id="local-6989586621681011537"><span class="annot"><span class="annottext">norm :: GlobalReg -&gt; CmmReg
</span><a href="#local-6989586621681011537"><span class="hs-identifier hs-var hs-var">norm</span></a></span></span><span> </span><span id="local-6989586621681011536"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011536"><span class="hs-identifier hs-var">x</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; CmmReg
</span><a href="GHC.Cmm.Expr.html#CmmGlobal"><span class="hs-identifier hs-var">CmmGlobal</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalReg -&gt; Int -&gt; GlobalReg
</span><a href="#local-6989586621681011534"><span class="hs-identifier hs-var">fpr_ctor</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011536"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>             </span><span class="hs-comment">-- get the first register of the family</span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-comment">-- For each class, we just have to fill missing registers numbers. We use</span><span>
</span><span id="line-210"></span><span>    </span><span class="hs-comment">-- the constructor of the greatest register to build padding registers.</span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-comment">-- E.g. sortedRs = [   F2,   XMM4, D5]</span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-comment">--      output   = [D1,   D3]</span><span>
</span><span id="line-214"></span><span>    </span><span id="local-6989586621681011543"><span class="annot"><span class="annottext">padded :: LiveGlobalRegs
</span><a href="#local-6989586621681011543"><span class="hs-identifier hs-var hs-var">padded</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LiveGlobalRegs -&gt; LiveGlobalRegs)
-&gt; [LiveGlobalRegs] -&gt; LiveGlobalRegs
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs -&gt; LiveGlobalRegs
</span><a href="#local-6989586621681011531"><span class="hs-identifier hs-var">padClass</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveGlobalRegs]
</span><a href="#local-6989586621681011541"><span class="hs-identifier hs-var">classes</span></a></span><span>
</span><span id="line-215"></span><span>    </span><span id="local-6989586621681011531"><span class="annot"><span class="annottext">padClass :: LiveGlobalRegs -&gt; LiveGlobalRegs
</span><a href="#local-6989586621681011531"><span class="hs-identifier hs-var hs-var">padClass</span></a></span></span><span> </span><span id="local-6989586621681011528"><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011528"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs -&gt; [Int] -&gt; LiveGlobalRegs
</span><a href="#local-6989586621681011527"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011526"><span class="hs-identifier hs-var">sortedRs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span>
</span><span id="line-216"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-217"></span><span>         </span><span id="local-6989586621681011526"><span class="annot"><span class="annottext">sortedRs :: LiveGlobalRegs
</span><a href="#local-6989586621681011526"><span class="hs-identifier hs-var hs-var">sortedRs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GlobalReg -&gt; GlobalReg -&gt; Ordering)
-&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#sortBy"><span class="hs-identifier hs-var">sortBy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GlobalReg -&gt; Int) -&gt; GlobalReg -&gt; GlobalReg -&gt; Ordering
forall a b. Ord a =&gt; (b -&gt; a) -&gt; b -&gt; b -&gt; Ordering
</span><a href="../../base/src/Data.Ord.html#comparing"><span class="hs-identifier hs-var">comparing</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Int
</span><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011528"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-218"></span><span>         </span><span id="local-6989586621681011522"><span class="annot"><span class="annottext">maxr :: GlobalReg
</span><a href="#local-6989586621681011522"><span class="hs-identifier hs-var hs-var">maxr</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs -&gt; GlobalReg
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011526"><span class="hs-identifier hs-var">sortedRs</span></a></span><span>
</span><span id="line-219"></span><span>         </span><span id="local-6989586621681011520"><span class="annot"><span class="annottext">ctor :: Int -&gt; GlobalReg
</span><a href="#local-6989586621681011520"><span class="hs-identifier hs-var hs-var">ctor</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Int -&gt; GlobalReg
</span><a href="#local-6989586621681011534"><span class="hs-identifier hs-var">fpr_ctor</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011522"><span class="hs-identifier hs-var">maxr</span></a></span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span>         </span><span id="local-6989586621681011527"><span class="annot"><span class="annottext">go :: LiveGlobalRegs -&gt; [Int] -&gt; LiveGlobalRegs
</span><a href="#local-6989586621681011527"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Int]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-222"></span><span>         </span><span class="annot"><a href="#local-6989586621681011527"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681011509"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011509"><span class="hs-identifier hs-var">c1</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681011508"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011508"><span class="hs-identifier hs-var">c2</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Int]
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-comment">-- detect bogus case (see #17920)</span><span>
</span><span id="line-223"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Int
</span><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011509"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Int
</span><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011508"><span class="hs-identifier hs-var">c2</span></a></span><span>
</span><span id="line-224"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681011507"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681011507"><span class="hs-identifier hs-var">real</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; GlobalReg -&gt; Maybe RealReg
</span><a href="GHC.Platform.Regs.html#globalRegMaybe"><span class="hs-identifier hs-var">globalRegMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011545"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011509"><span class="hs-identifier hs-var">c1</span></a></span><span>
</span><span id="line-225"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; LiveGlobalRegs
forall a. String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Panic.html#sorryDoc"><span class="hs-identifier hs-var">sorryDoc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LLVM code generator&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; LiveGlobalRegs) -&gt; SDoc -&gt; LiveGlobalRegs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-226"></span><span>               </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Found two different Cmm registers (&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011509"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;,&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011508"><span class="hs-identifier hs-var">c2</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-227"></span><span>               </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;) both alive AND mapped to the same real register: &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681011507"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-228"></span><span>               </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;. This isn't currently supported by the LLVM backend.&quot;</span></span><span>
</span><span id="line-229"></span><span>         </span><span class="annot"><a href="#local-6989586621681011527"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681011502"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011502"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681011501"><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011501"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681011500"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011500"><span class="hs-identifier hs-var">f</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681011499"><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621681011499"><span class="hs-identifier hs-var">fs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-230"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; Int
</span><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011502"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011500"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs -&gt; [Int] -&gt; LiveGlobalRegs
</span><a href="#local-6989586621681011527"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011501"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621681011499"><span class="hs-identifier hs-var">fs</span></a></span><span>              </span><span class="hs-comment">-- already covered by a real register</span><span>
</span><span id="line-231"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; GlobalReg
</span><a href="#local-6989586621681011520"><span class="hs-identifier hs-var">ctor</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011500"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs -&gt; [Int] -&gt; LiveGlobalRegs
</span><a href="#local-6989586621681011527"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011502"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">GlobalReg -&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><a href="#local-6989586621681011501"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621681011499"><span class="hs-identifier hs-var">fs</span></a></span><span> </span><span class="hs-comment">-- add padding register</span><span>
</span><span id="line-232"></span><span>         </span><span class="annot"><a href="#local-6989586621681011527"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiveGlobalRegs
forall a. HasCallStack =&gt; a
</span><a href="../../base/src/GHC.Err.html#undefined"><span class="hs-identifier hs-var">undefined</span></a></span><span> </span><span class="hs-comment">-- unreachable</span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span>    </span><span class="annot"><a href="#local-6989586621681011534"><span class="hs-identifier hs-type">fpr_ctor</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span>
</span><span id="line-235"></span><span>    </span><span id="local-6989586621681011534"><span class="annot"><span class="annottext">fpr_ctor :: GlobalReg -&gt; Int -&gt; GlobalReg
</span><a href="#local-6989586621681011534"><span class="hs-identifier hs-var hs-var">fpr_ctor</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#FloatReg"><span class="hs-identifier hs-type">FloatReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; GlobalReg
</span><a href="GHC.Cmm.Expr.html#FloatReg"><span class="hs-identifier hs-var">FloatReg</span></a></span><span>
</span><span id="line-236"></span><span>    </span><span class="annot"><a href="#local-6989586621681011534"><span class="hs-identifier hs-var">fpr_ctor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#DoubleReg"><span class="hs-identifier hs-type">DoubleReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; GlobalReg
</span><a href="GHC.Cmm.Expr.html#DoubleReg"><span class="hs-identifier hs-var">DoubleReg</span></a></span><span>
</span><span id="line-237"></span><span>    </span><span class="annot"><a href="#local-6989586621681011534"><span class="hs-identifier hs-var">fpr_ctor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#XmmReg"><span class="hs-identifier hs-type">XmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; GlobalReg
</span><a href="GHC.Cmm.Expr.html#XmmReg"><span class="hs-identifier hs-var">XmmReg</span></a></span><span>
</span><span id="line-238"></span><span>    </span><span class="annot"><a href="#local-6989586621681011534"><span class="hs-identifier hs-var">fpr_ctor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#YmmReg"><span class="hs-identifier hs-type">YmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; GlobalReg
</span><a href="GHC.Cmm.Expr.html#YmmReg"><span class="hs-identifier hs-var">YmmReg</span></a></span><span>
</span><span id="line-239"></span><span>    </span><span class="annot"><a href="#local-6989586621681011534"><span class="hs-identifier hs-var">fpr_ctor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#ZmmReg"><span class="hs-identifier hs-type">ZmmReg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; GlobalReg
</span><a href="GHC.Cmm.Expr.html#ZmmReg"><span class="hs-identifier hs-var">ZmmReg</span></a></span><span>
</span><span id="line-240"></span><span>    </span><span class="annot"><a href="#local-6989586621681011534"><span class="hs-identifier hs-var">fpr_ctor</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int -&gt; GlobalReg
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fpr_ctor expected only FPR regs&quot;</span></span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span>    </span><span class="annot"><a href="#local-6989586621681011523"><span class="hs-identifier hs-type">fpr_num</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-243"></span><span>    </span><span id="local-6989586621681011523"><span class="annot"><span class="annottext">fpr_num :: GlobalReg -&gt; Int
</span><a href="#local-6989586621681011523"><span class="hs-identifier hs-var hs-var">fpr_num</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#FloatReg"><span class="hs-identifier hs-type">FloatReg</span></a></span><span> </span><span id="local-6989586621681011496"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011496"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011496"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-244"></span><span>    </span><span class="annot"><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#DoubleReg"><span class="hs-identifier hs-type">DoubleReg</span></a></span><span> </span><span id="local-6989586621681011495"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011495"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011495"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-245"></span><span>    </span><span class="annot"><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#XmmReg"><span class="hs-identifier hs-type">XmmReg</span></a></span><span> </span><span id="local-6989586621681011494"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011494"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011494"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-246"></span><span>    </span><span class="annot"><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#YmmReg"><span class="hs-identifier hs-type">YmmReg</span></a></span><span> </span><span id="local-6989586621681011493"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011493"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011493"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-247"></span><span>    </span><span class="annot"><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#ZmmReg"><span class="hs-identifier hs-type">ZmmReg</span></a></span><span> </span><span id="local-6989586621681011492"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011492"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681011492"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-248"></span><span>    </span><span class="annot"><a href="#local-6989586621681011523"><span class="hs-identifier hs-var">fpr_num</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fpr_num expected only FPR regs&quot;</span></span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span>
</span><span id="line-251"></span><span class="hs-comment">-- | Llvm standard fun attributes</span><span>
</span><span id="line-252"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmStdFunAttrs"><span class="hs-identifier hs-type">llvmStdFunAttrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmFuncAttr"><span class="hs-identifier hs-type">LlvmFuncAttr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-253"></span><span id="llvmStdFunAttrs"><span class="annot"><span class="annottext">llvmStdFunAttrs :: [LlvmFuncAttr]
</span><a href="GHC.CmmToLlvm.Base.html#llvmStdFunAttrs"><span class="hs-identifier hs-var hs-var">llvmStdFunAttrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmFuncAttr
</span><a href="GHC.Llvm.Types.html#NoUnwind"><span class="hs-identifier hs-var">NoUnwind</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-254"></span><span>
</span><span id="line-255"></span><span class="hs-comment">-- | Convert a list of types to a list of function parameters</span><span>
</span><span id="line-256"></span><span class="hs-comment">-- (each with no parameter attributes)</span><span>
</span><span id="line-257"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#tysToParams"><span class="hs-identifier hs-type">tysToParams</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmParameter"><span class="hs-identifier hs-type">LlvmParameter</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-258"></span><span id="tysToParams"><span class="annot"><span class="annottext">tysToParams :: [LlvmType] -&gt; [(LlvmType, [LlvmParamAttr])]
</span><a href="GHC.CmmToLlvm.Base.html#tysToParams"><span class="hs-identifier hs-var hs-var">tysToParams</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmType -&gt; (LlvmType, [LlvmParamAttr]))
-&gt; [LlvmType] -&gt; [(LlvmType, [LlvmParamAttr])]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681011489"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011489"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011489"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span class="hs-comment">-- | Pointer width</span><span>
</span><span id="line-261"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmPtrBits"><span class="hs-identifier hs-type">llvmPtrBits</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-262"></span><span id="llvmPtrBits"><span class="annot"><span class="annottext">llvmPtrBits :: Platform -&gt; Int
</span><a href="GHC.CmmToLlvm.Base.html#llvmPtrBits"><span class="hs-identifier hs-var hs-var">llvmPtrBits</span></a></span></span><span> </span><span id="local-6989586621681011488"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011488"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Width -&gt; Int
</span><a href="GHC.Cmm.Type.html#widthInBits"><span class="hs-identifier hs-var">widthInBits</span></a></span><span> </span><span class="annot"><span class="annottext">(Width -&gt; Int) -&gt; Width -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CmmType -&gt; Width
</span><a href="GHC.Cmm.Type.html#typeWidth"><span class="hs-identifier hs-var">typeWidth</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmType -&gt; Width) -&gt; CmmType -&gt; Width
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; CmmType
</span><a href="GHC.Cmm.Type.html#gcWord"><span class="hs-identifier hs-var">gcWord</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011488"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-263"></span><span>
</span><span id="line-264"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-265"></span><span class="hs-comment">-- * Llvm Version</span><span>
</span><span id="line-266"></span><span class="hs-comment">--</span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span class="hs-keyword">newtype</span><span> </span><span id="LlvmVersion"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-var">LlvmVersion</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="LlvmVersion"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-var">LlvmVersion</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="llvmVersionNE"><span class="annot"><span class="annottext">LlvmVersion -&gt; NonEmpty Int
</span><a href="GHC.CmmToLlvm.Base.html#llvmVersionNE"><span class="hs-identifier hs-var hs-var">llvmVersionNE</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NE.NonEmpty</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-269"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681011477"><span id="local-6989586621681011483"><span class="annot"><span class="annottext">LlvmVersion -&gt; LlvmVersion -&gt; Bool
(LlvmVersion -&gt; LlvmVersion -&gt; Bool)
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; Bool) -&gt; Eq LlvmVersion
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
$c/= :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
== :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
$c== :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681011437"><span id="local-6989586621681011442"><span id="local-6989586621681011447"><span id="local-6989586621681011452"><span id="local-6989586621681011457"><span id="local-6989586621681011462"><span id="local-6989586621681011468"><span class="annot"><span class="annottext">Eq LlvmVersion
Eq LlvmVersion
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; Ordering)
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; Bool)
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; Bool)
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; Bool)
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; Bool)
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; LlvmVersion)
-&gt; (LlvmVersion -&gt; LlvmVersion -&gt; LlvmVersion)
-&gt; Ord LlvmVersion
LlvmVersion -&gt; LlvmVersion -&gt; Bool
LlvmVersion -&gt; LlvmVersion -&gt; Ordering
LlvmVersion -&gt; LlvmVersion -&gt; LlvmVersion
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: LlvmVersion -&gt; LlvmVersion -&gt; LlvmVersion
$cmin :: LlvmVersion -&gt; LlvmVersion -&gt; LlvmVersion
max :: LlvmVersion -&gt; LlvmVersion -&gt; LlvmVersion
$cmax :: LlvmVersion -&gt; LlvmVersion -&gt; LlvmVersion
&gt;= :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
$c&gt;= :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
&gt; :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
$c&gt; :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
&lt;= :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
$c&lt;= :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
&lt; :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
$c&lt; :: LlvmVersion -&gt; LlvmVersion -&gt; Bool
compare :: LlvmVersion -&gt; LlvmVersion -&gt; Ordering
$ccompare :: LlvmVersion -&gt; LlvmVersion -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span>
</span><span id="line-271"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#parseLlvmVersion"><span class="hs-identifier hs-type">parseLlvmVersion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span>
</span><span id="line-272"></span><span id="parseLlvmVersion"><span class="annot"><span class="annottext">parseLlvmVersion :: String -&gt; Maybe LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#parseLlvmVersion"><span class="hs-identifier hs-var hs-var">parseLlvmVersion</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-273"></span><span>    </span><span class="annot"><span class="annottext">(NonEmpty Int -&gt; LlvmVersion)
-&gt; Maybe (NonEmpty Int) -&gt; Maybe LlvmVersion
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty Int -&gt; LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-var">LlvmVersion</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (NonEmpty Int) -&gt; Maybe LlvmVersion)
-&gt; (String -&gt; Maybe (NonEmpty Int)) -&gt; String -&gt; Maybe LlvmVersion
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; Maybe (NonEmpty Int)
forall a. [a] -&gt; Maybe (NonEmpty a)
</span><a href="../../base/src/Data.List.NonEmpty.html#nonEmpty"><span class="hs-identifier hs-var">NE.nonEmpty</span></a></span><span> </span><span class="annot"><span class="annottext">([Int] -&gt; Maybe (NonEmpty Int))
-&gt; (String -&gt; [Int]) -&gt; String -&gt; Maybe (NonEmpty Int)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; String -&gt; [Int]
forall {a}. Read a =&gt; [a] -&gt; String -&gt; [a]
</span><a href="#local-6989586621681011431"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(String -&gt; [Int]) -&gt; (String -&gt; String) -&gt; String -&gt; [Int]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; String
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Char -&gt; Bool) -&gt; Char -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-274"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-275"></span><span>    </span><span id="local-6989586621681011431"><span class="annot"><span class="annottext">go :: [a] -&gt; String -&gt; [a]
</span><a href="#local-6989586621681011431"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621681011425"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681011425"><span class="hs-identifier hs-var">vs</span></a></span></span><span> </span><span id="local-6989586621681011424"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011424"><span class="hs-identifier hs-var">s</span></a></span></span><span>
</span><span id="line-276"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011422"><span class="hs-identifier hs-var">ver_str</span></a></span><span>
</span><span id="line-277"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681011425"><span class="hs-identifier hs-var">vs</span></a></span><span>
</span><span id="line-278"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681011420"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011420"><span class="hs-identifier hs-var">rest'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011419"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-279"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; String -&gt; [a]
</span><a href="#local-6989586621681011431"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
forall a. Read a =&gt; String -&gt; a
</span><a href="../../base/src/Text.Read.html#read"><span class="hs-identifier hs-var">read</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011422"><span class="hs-identifier hs-var">ver_str</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681011425"><span class="hs-identifier hs-var">vs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011420"><span class="hs-identifier hs-var">rest'</span></a></span><span>
</span><span id="line-280"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-281"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
forall a. Read a =&gt; String -&gt; a
</span><a href="../../base/src/Text.Read.html#read"><span class="hs-identifier hs-var">read</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011422"><span class="hs-identifier hs-var">ver_str</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681011425"><span class="hs-identifier hs-var">vs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-282"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-283"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681011422"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011422"><span class="hs-identifier hs-var">ver_str</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681011419"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011419"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#span"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011424"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span class="hs-comment">-- | The (inclusive) lower bound on the LLVM Version that is currently supported.</span><span>
</span><span id="line-286"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionLowerBound"><span class="hs-identifier hs-type">supportedLlvmVersionLowerBound</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span>
</span><span id="line-287"></span><span id="supportedLlvmVersionLowerBound"><span class="annot"><span class="annottext">supportedLlvmVersionLowerBound :: LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionLowerBound"><span class="hs-identifier hs-var hs-var">supportedLlvmVersionLowerBound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NonEmpty Int -&gt; LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-var">LlvmVersion</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-identifier">sUPPORTED_LLVM_VERSION_MIN</span><span> </span><span class="hs-operator">NE.:|</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-288"></span><span>
</span><span id="line-289"></span><span class="hs-comment">-- | The (not-inclusive) upper bound  bound on the LLVM Version that is currently supported.</span><span>
</span><span id="line-290"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionUpperBound"><span class="hs-identifier hs-type">supportedLlvmVersionUpperBound</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span>
</span><span id="line-291"></span><span id="supportedLlvmVersionUpperBound"><span class="annot"><span class="annottext">supportedLlvmVersionUpperBound :: LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionUpperBound"><span class="hs-identifier hs-var hs-var">supportedLlvmVersionUpperBound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NonEmpty Int -&gt; LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-var">LlvmVersion</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-identifier">sUPPORTED_LLVM_VERSION_MAX</span><span> </span><span class="hs-operator">NE.:|</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmVersionSupported"><span class="hs-identifier hs-type">llvmVersionSupported</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-294"></span><span id="llvmVersionSupported"><span class="annot"><span class="annottext">llvmVersionSupported :: LlvmVersion -&gt; Bool
</span><a href="GHC.CmmToLlvm.Base.html#llvmVersionSupported"><span class="hs-identifier hs-var hs-var">llvmVersionSupported</span></a></span></span><span> </span><span id="local-6989586621681011415"><span class="annot"><span class="annottext">LlvmVersion
</span><a href="#local-6989586621681011415"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-295"></span><span>  </span><span class="annot"><span class="annottext">LlvmVersion
</span><a href="#local-6989586621681011415"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVersion -&gt; LlvmVersion -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionLowerBound"><span class="hs-identifier hs-var">supportedLlvmVersionLowerBound</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">LlvmVersion
</span><a href="#local-6989586621681011415"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVersion -&gt; LlvmVersion -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#supportedLlvmVersionUpperBound"><span class="hs-identifier hs-var">supportedLlvmVersionUpperBound</span></a></span><span>
</span><span id="line-296"></span><span>
</span><span id="line-297"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmVersionStr"><span class="hs-identifier hs-type">llvmVersionStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-298"></span><span id="llvmVersionStr"><span class="annot"><span class="annottext">llvmVersionStr :: LlvmVersion -&gt; String
</span><a href="GHC.CmmToLlvm.Base.html#llvmVersionStr"><span class="hs-identifier hs-var hs-var">llvmVersionStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; String
forall a. [a] -&gt; [[a]] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#intercalate"><span class="hs-identifier hs-var">intercalate</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.&quot;</span></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; String)
-&gt; (LlvmVersion -&gt; [String]) -&gt; LlvmVersion -&gt; String
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; String) -&gt; [Int] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">([Int] -&gt; [String])
-&gt; (LlvmVersion -&gt; [Int]) -&gt; LlvmVersion -&gt; [String]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVersion -&gt; [Int]
</span><a href="GHC.CmmToLlvm.Base.html#llvmVersionList"><span class="hs-identifier hs-var">llvmVersionList</span></a></span><span>
</span><span id="line-299"></span><span>
</span><span id="line-300"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmVersionList"><span class="hs-identifier hs-type">llvmVersionList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">]</span><span>
</span><span id="line-301"></span><span id="llvmVersionList"><span class="annot"><span class="annottext">llvmVersionList :: LlvmVersion -&gt; [Int]
</span><a href="GHC.CmmToLlvm.Base.html#llvmVersionList"><span class="hs-identifier hs-var hs-var">llvmVersionList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NonEmpty Int -&gt; [Int]
forall a. NonEmpty a -&gt; [a]
</span><a href="../../base/src/Data.List.NonEmpty.html#toList"><span class="hs-identifier hs-var">NE.toList</span></a></span><span> </span><span class="annot"><span class="annottext">(NonEmpty Int -&gt; [Int])
-&gt; (LlvmVersion -&gt; NonEmpty Int) -&gt; LlvmVersion -&gt; [Int]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVersion -&gt; NonEmpty Int
</span><a href="GHC.CmmToLlvm.Base.html#llvmVersionNE"><span class="hs-identifier hs-var hs-var">llvmVersionNE</span></a></span><span>
</span><span id="line-302"></span><span>
</span><span id="line-303"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-304"></span><span class="hs-comment">-- * Environment Handling</span><span>
</span><span id="line-305"></span><span class="hs-comment">--</span><span>
</span><span id="line-306"></span><span>
</span><span id="line-307"></span><span class="hs-keyword">data</span><span> </span><span id="LlvmEnv"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-var">LlvmEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="LlvmEnv"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-var">LlvmEnv</span></a></span></span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="envVersion"><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#envVersion"><span class="hs-identifier hs-var hs-var">envVersion</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span>      </span><span class="hs-comment">-- ^ LLVM version</span><span>
</span><span id="line-309"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envOpts"><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmOpts
</span><a href="GHC.CmmToLlvm.Base.html#envOpts"><span class="hs-identifier hs-var hs-var">envOpts</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmOpts"><span class="hs-identifier hs-type">LlvmOpts</span></a></span><span>         </span><span class="hs-comment">-- ^ LLVM backend options</span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envDynFlags"><span class="annot"><span class="annottext">LlvmEnv -&gt; DynFlags
</span><a href="GHC.CmmToLlvm.Base.html#envDynFlags"><span class="hs-identifier hs-var hs-var">envDynFlags</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>        </span><span class="hs-comment">-- ^ Dynamic flags</span><span>
</span><span id="line-311"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envOutput"><span class="annot"><span class="annottext">LlvmEnv -&gt; BufHandle
</span><a href="GHC.CmmToLlvm.Base.html#envOutput"><span class="hs-identifier hs-var hs-var">envOutput</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.BufHandle.html#BufHandle"><span class="hs-identifier hs-type">BufHandle</span></a></span><span>         </span><span class="hs-comment">-- ^ Output buffer</span><span>
</span><span id="line-312"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envMask"><span class="annot"><span class="annottext">LlvmEnv -&gt; Char
</span><a href="GHC.CmmToLlvm.Base.html#envMask"><span class="hs-identifier hs-var hs-var">envMask</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span>               </span><span class="hs-comment">-- ^ Mask for creating unique values</span><span>
</span><span id="line-313"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envFreshMeta"><span class="annot"><span class="annottext">LlvmEnv -&gt; MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envFreshMeta"><span class="hs-identifier hs-var hs-var">envFreshMeta</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaId"><span class="hs-identifier hs-type">MetaId</span></a></span><span>         </span><span class="hs-comment">-- ^ Supply of fresh metadata IDs</span><span>
</span><span id="line-314"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envUniqMeta"><span class="annot"><span class="annottext">LlvmEnv -&gt; UniqFM Unique MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envUniqMeta"><span class="hs-identifier hs-var hs-var">envUniqMeta</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaId"><span class="hs-identifier hs-type">MetaId</span></a></span><span>   </span><span class="hs-comment">-- ^ Global metadata nodes</span><span>
</span><span id="line-315"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envFunMap"><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envFunMap"><span class="hs-identifier hs-var hs-var">envFunMap</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnvMap"><span class="hs-identifier hs-type">LlvmEnvMap</span></a></span><span>        </span><span class="hs-comment">-- ^ Global functions so far, with type</span><span>
</span><span id="line-316"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envAliases"><span class="annot"><span class="annottext">LlvmEnv -&gt; UniqSet LMString
</span><a href="GHC.CmmToLlvm.Base.html#envAliases"><span class="hs-identifier hs-var hs-var">envAliases</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span> </span><span class="hs-comment">-- ^ Globals that we had to alias, see [Llvm Forward References]</span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envUsedVars"><span class="annot"><span class="annottext">LlvmEnv -&gt; [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#envUsedVars"><span class="hs-identifier hs-var hs-var">envUsedVars</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmVar"><span class="hs-identifier hs-type">LlvmVar</span></a></span><span class="hs-special">]</span><span>       </span><span class="hs-comment">-- ^ Pointers to be added to llvm.used (see @cmmUsedLlvmGens@)</span><span>
</span><span id="line-318"></span><span>
</span><span id="line-319"></span><span>    </span><span class="hs-comment">-- the following get cleared for every function (see @withClearVars@)</span><span>
</span><span id="line-320"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envVarMap"><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envVarMap"><span class="hs-identifier hs-var hs-var">envVarMap</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnvMap"><span class="hs-identifier hs-type">LlvmEnvMap</span></a></span><span>        </span><span class="hs-comment">-- ^ Local variables so far, with type</span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="envStackRegs"><span class="annot"><span class="annottext">LlvmEnv -&gt; LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#envStackRegs"><span class="hs-identifier hs-var hs-var">envStackRegs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span class="hs-special">]</span><span>    </span><span class="hs-comment">-- ^ Non-constant registers (alloca'd in the function prelude)</span><span>
</span><span id="line-322"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-323"></span><span>
</span><span id="line-324"></span><span class="hs-keyword">type</span><span> </span><span id="LlvmEnvMap"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnvMap"><span class="hs-identifier hs-var">LlvmEnvMap</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span class="hs-comment">-- | The Llvm monad. Wraps @LlvmEnv@ state as well as the @IO@ monad</span><span>
</span><span id="line-327"></span><span class="hs-keyword">newtype</span><span> </span><span id="LlvmM"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span></span><span> </span><span id="local-6989586621681011875"><span class="annot"><a href="#local-6989586621681011875"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="LlvmM"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="runLlvmM"><span class="annot"><span class="annottext">forall a. LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
</span><a href="GHC.CmmToLlvm.Base.html#runLlvmM"><span class="hs-identifier hs-var hs-var">runLlvmM</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-type">LlvmEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681011875"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-type">LlvmEnv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-328"></span><span>    </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681011391"><span id="local-6989586621681011395"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; LlvmM a -&gt; LlvmM b)
-&gt; (forall a b. a -&gt; LlvmM b -&gt; LlvmM a) -&gt; Functor LlvmM
forall a b. a -&gt; LlvmM b -&gt; LlvmM a
forall a b. (a -&gt; b) -&gt; LlvmM a -&gt; LlvmM b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; LlvmM b -&gt; LlvmM a
$c&lt;$ :: forall a b. a -&gt; LlvmM b -&gt; LlvmM a
fmap :: forall a b. (a -&gt; b) -&gt; LlvmM a -&gt; LlvmM b
$cfmap :: forall a b. (a -&gt; b) -&gt; LlvmM a -&gt; LlvmM b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-329"></span><span>
</span><span id="line-330"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681011379"><span id="local-6989586621681011381"><span id="local-6989586621681011383"><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-331"></span><span>    </span><span id="local-6989586621681011376"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; LlvmM a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span id="local-6989586621681011375"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011375"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a)
-&gt; (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011374"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011374"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, LlvmEnv) -&gt; IO (a, LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011375"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011374"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-332"></span><span>    </span><span id="local-6989586621681011372"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. LlvmM (a -&gt; b) -&gt; LlvmM a -&gt; LlvmM b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;*&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmM (a -&gt; b) -&gt; LlvmM a -&gt; LlvmM b
forall (m :: * -&gt; *) a b. Monad m =&gt; m (a -&gt; b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#ap"><span class="hs-identifier hs-var">ap</span></a></span><span>
</span><span id="line-333"></span><span>
</span><span id="line-334"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681011365"><span id="local-6989586621681011367"><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-335"></span><span>    </span><span id="local-6989586621681011362"><span class="annot"><span class="annottext">LlvmM a
</span><a href="#local-6989586621681011362"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621681011361"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b. LlvmM a -&gt; (a -&gt; LlvmM b) -&gt; LlvmM b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">&gt;&gt;=</span></a></span></span><span> </span><span id="local-6989586621681011360"><span class="annot"><span class="annottext">a -&gt; LlvmM b
</span><a href="#local-6989586621681011360"><span class="hs-identifier hs-var">f</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (b, LlvmEnv)) -&gt; LlvmM b
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; IO (b, LlvmEnv)) -&gt; LlvmM b)
-&gt; (LlvmEnv -&gt; IO (b, LlvmEnv)) -&gt; LlvmM b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011359"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011359"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681011358"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011358"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681011357"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011357"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
forall a. LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
</span><a href="GHC.CmmToLlvm.Base.html#runLlvmM"><span class="hs-identifier hs-var hs-var">runLlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmM a
</span><a href="#local-6989586621681011362"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011359"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-336"></span><span>                                  </span><span class="annot"><span class="annottext">LlvmM b -&gt; LlvmEnv -&gt; IO (b, LlvmEnv)
forall a. LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
</span><a href="GHC.CmmToLlvm.Base.html#runLlvmM"><span class="hs-identifier hs-var hs-var">runLlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; LlvmM b
</span><a href="#local-6989586621681011360"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011358"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011357"><span class="hs-identifier hs-var">env'</span></a></span><span>
</span><span id="line-337"></span><span>
</span><span id="line-338"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#HasDynFlags"><span class="hs-identifier hs-type">HasDynFlags</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-339"></span><span>    </span><span id="local-6989586621681011353"><span class="annot"><span class="annottext">getDynFlags :: LlvmM DynFlags
</span><a href="#local-6989586621681011353"><span class="hs-identifier hs-var hs-var hs-var hs-var">getDynFlags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (DynFlags, LlvmEnv)) -&gt; LlvmM DynFlags
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; IO (DynFlags, LlvmEnv)) -&gt; LlvmM DynFlags)
-&gt; (LlvmEnv -&gt; IO (DynFlags, LlvmEnv)) -&gt; LlvmM DynFlags
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011352"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011352"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(DynFlags, LlvmEnv) -&gt; IO (DynFlags, LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; DynFlags
</span><a href="GHC.CmmToLlvm.Base.html#envDynFlags"><span class="hs-identifier hs-var hs-var">envDynFlags</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011352"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011352"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-340"></span><span>
</span><span id="line-341"></span><span class="hs-comment">-- | Get target platform</span><span>
</span><span id="line-342"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getPlatform"><span class="hs-identifier hs-type">getPlatform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span>
</span><span id="line-343"></span><span id="getPlatform"><span class="annot"><span class="annottext">getPlatform :: LlvmM Platform
</span><a href="GHC.CmmToLlvm.Base.html#getPlatform"><span class="hs-identifier hs-var hs-var">getPlatform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmOpts -&gt; Platform
</span><a href="GHC.Llvm.Types.html#llvmOptsPlatform"><span class="hs-identifier hs-var hs-var">llvmOptsPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmOpts -&gt; Platform) -&gt; LlvmM LlvmOpts -&gt; LlvmM Platform
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmM LlvmOpts
</span><a href="GHC.CmmToLlvm.Base.html#getLlvmOpts"><span class="hs-identifier hs-var">getLlvmOpts</span></a></span><span>
</span><span id="line-344"></span><span>
</span><span id="line-345"></span><span class="hs-comment">-- | Get LLVM options</span><span>
</span><span id="line-346"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getLlvmOpts"><span class="hs-identifier hs-type">getLlvmOpts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmOpts"><span class="hs-identifier hs-type">LlvmOpts</span></a></span><span>
</span><span id="line-347"></span><span id="getLlvmOpts"><span class="annot"><span class="annottext">getLlvmOpts :: LlvmM LlvmOpts
</span><a href="GHC.CmmToLlvm.Base.html#getLlvmOpts"><span class="hs-identifier hs-var hs-var">getLlvmOpts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (LlvmOpts, LlvmEnv)) -&gt; LlvmM LlvmOpts
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; IO (LlvmOpts, LlvmEnv)) -&gt; LlvmM LlvmOpts)
-&gt; (LlvmEnv -&gt; IO (LlvmOpts, LlvmEnv)) -&gt; LlvmM LlvmOpts
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011349"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011349"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(LlvmOpts, LlvmEnv) -&gt; IO (LlvmOpts, LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmOpts
</span><a href="GHC.CmmToLlvm.Base.html#envOpts"><span class="hs-identifier hs-var hs-var">envOpts</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011349"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011349"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-348"></span><span>
</span><span id="line-349"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681011343"><span class="annot"><a href="GHC.Types.Unique.Supply.html#MonadUnique"><span class="hs-identifier hs-type">MonadUnique</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-350"></span><span>    </span><span id="local-6989586621681011340"><span class="annot"><span class="annottext">getUniqueSupplyM :: LlvmM UniqSupply
</span><a href="GHC.Types.Unique.Supply.html#getUniqueSupplyM"><span class="hs-identifier hs-var hs-var hs-var hs-var">getUniqueSupplyM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-351"></span><span>        </span><span id="local-6989586621681011338"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681011338"><span class="hs-identifier hs-var">mask</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; Char) -&gt; LlvmM Char
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; Char
</span><a href="GHC.CmmToLlvm.Base.html#envMask"><span class="hs-identifier hs-var hs-var">envMask</span></a></span><span>
</span><span id="line-352"></span><span>        </span><span class="annot"><span class="annottext">IO UniqSupply -&gt; LlvmM UniqSupply
forall a. IO a -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO UniqSupply -&gt; LlvmM UniqSupply)
-&gt; IO UniqSupply -&gt; LlvmM UniqSupply
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; IO UniqSupply
</span><a href="GHC.Types.Unique.Supply.html#mkSplitUniqSupply"><span class="hs-identifier hs-var">mkSplitUniqSupply</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681011338"><span class="hs-identifier hs-var">mask</span></a></span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span>    </span><span id="local-6989586621681011332"><span class="annot"><span class="annottext">getUniqueM :: LlvmM Unique
</span><a href="GHC.Types.Unique.Supply.html#getUniqueM"><span class="hs-identifier hs-var hs-var hs-var hs-var">getUniqueM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-355"></span><span>        </span><span id="local-6989586621681011330"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681011330"><span class="hs-identifier hs-var">mask</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; Char) -&gt; LlvmM Char
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; Char
</span><a href="GHC.CmmToLlvm.Base.html#envMask"><span class="hs-identifier hs-var hs-var">envMask</span></a></span><span>
</span><span id="line-356"></span><span>        </span><span class="annot"><span class="annottext">IO Unique -&gt; LlvmM Unique
forall a. IO a -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO Unique -&gt; LlvmM Unique) -&gt; IO Unique -&gt; LlvmM Unique
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; IO Unique
</span><a href="GHC.Types.Unique.Supply.html#uniqFromMask"><span class="hs-identifier hs-var">uniqFromMask</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681011330"><span class="hs-identifier hs-var">mask</span></a></span><span>
</span><span id="line-357"></span><span>
</span><span id="line-358"></span><span class="hs-comment">-- | Lifting of IO actions. Not exported, as we want to encapsulate IO.</span><span>
</span><span id="line-359"></span><span id="local-6989586621681011841"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#liftIO"><span class="hs-identifier hs-type">liftIO</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681011841"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011841"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-360"></span><span id="liftIO"><span class="annot"><span class="annottext">liftIO :: forall a. IO a -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#liftIO"><span class="hs-identifier hs-var hs-var">liftIO</span></a></span></span><span> </span><span id="local-6989586621681011326"><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621681011326"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a)
-&gt; (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011325"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011325"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681011324"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011324"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621681011326"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-361"></span><span>                              </span><span class="annot"><span class="annottext">(a, LlvmEnv) -&gt; IO (a, LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011324"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011325"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="hs-comment">-- | Get initial Llvm environment.</span><span>
</span><span id="line-364"></span><span id="local-6989586621681011839"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#runLlvm"><span class="hs-identifier hs-type">runLlvm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.BufHandle.html#BufHandle"><span class="hs-identifier hs-type">BufHandle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011839"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681011839"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-365"></span><span id="runLlvm"><span class="annot"><span class="annottext">runLlvm :: forall a. DynFlags -&gt; LlvmVersion -&gt; BufHandle -&gt; LlvmM a -&gt; IO a
</span><a href="GHC.CmmToLlvm.Base.html#runLlvm"><span class="hs-identifier hs-var hs-var">runLlvm</span></a></span></span><span> </span><span id="local-6989586621681011321"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011321"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681011320"><span class="annot"><span class="annottext">LlvmVersion
</span><a href="#local-6989586621681011320"><span class="hs-identifier hs-var">ver</span></a></span></span><span> </span><span id="local-6989586621681011319"><span class="annot"><span class="annottext">BufHandle
</span><a href="#local-6989586621681011319"><span class="hs-identifier hs-var">out</span></a></span></span><span> </span><span id="local-6989586621681011318"><span class="annot"><span class="annottext">LlvmM a
</span><a href="#local-6989586621681011318"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-366"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681011317"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011317"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
forall a. LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
</span><a href="GHC.CmmToLlvm.Base.html#runLlvmM"><span class="hs-identifier hs-var hs-var">runLlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmM a
</span><a href="#local-6989586621681011318"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011316"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-367"></span><span>    </span><span class="annot"><span class="annottext">a -&gt; IO a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011317"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-368"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681011316"><span class="annot"><span class="annottext">env :: LlvmEnv
</span><a href="#local-6989586621681011316"><span class="hs-identifier hs-var hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmEnv :: LlvmVersion
-&gt; LlvmOpts
-&gt; DynFlags
-&gt; BufHandle
-&gt; Char
-&gt; MetaId
-&gt; UniqFM Unique MetaId
-&gt; LlvmEnvMap
-&gt; UniqSet LMString
-&gt; [LlvmVar]
-&gt; LlvmEnvMap
-&gt; LiveGlobalRegs
-&gt; LlvmEnv
</span><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-type">LlvmEnv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envFunMap :: LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envFunMap"><span class="hs-identifier hs-var">envFunMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span>
</span><span id="line-369"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envVarMap :: LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envVarMap"><span class="hs-identifier hs-var">envVarMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span>
</span><span id="line-370"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envStackRegs :: LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#envStackRegs"><span class="hs-identifier hs-var">envStackRegs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-371"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envUsedVars :: [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#envUsedVars"><span class="hs-identifier hs-var">envUsedVars</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-372"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envAliases :: UniqSet LMString
</span><a href="GHC.CmmToLlvm.Base.html#envAliases"><span class="hs-identifier hs-var">envAliases</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet LMString
forall a. UniqSet a
</span><a href="GHC.Types.Unique.Set.html#emptyUniqSet"><span class="hs-identifier hs-var">emptyUniqSet</span></a></span><span>
</span><span id="line-373"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envVersion :: LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#envVersion"><span class="hs-identifier hs-var">envVersion</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmVersion
</span><a href="#local-6989586621681011320"><span class="hs-identifier hs-var">ver</span></a></span><span>
</span><span id="line-374"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envOpts :: LlvmOpts
</span><a href="GHC.CmmToLlvm.Base.html#envOpts"><span class="hs-identifier hs-var">envOpts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; LlvmOpts
</span><a href="GHC.Llvm.Types.html#initLlvmOpts"><span class="hs-identifier hs-var">initLlvmOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011321"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-375"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envDynFlags :: DynFlags
</span><a href="GHC.CmmToLlvm.Base.html#envDynFlags"><span class="hs-identifier hs-var">envDynFlags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011321"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-376"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envOutput :: BufHandle
</span><a href="GHC.CmmToLlvm.Base.html#envOutput"><span class="hs-identifier hs-var">envOutput</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BufHandle
</span><a href="#local-6989586621681011319"><span class="hs-identifier hs-var">out</span></a></span><span>
</span><span id="line-377"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envMask :: Char
</span><a href="GHC.CmmToLlvm.Base.html#envMask"><span class="hs-identifier hs-var">envMask</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'n'</span></span><span>
</span><span id="line-378"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envFreshMeta :: MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envFreshMeta"><span class="hs-identifier hs-var">envFreshMeta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; MetaId
</span><a href="GHC.Llvm.MetaData.html#MetaId"><span class="hs-identifier hs-var">MetaId</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-379"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envUniqMeta :: UniqFM Unique MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envUniqMeta"><span class="hs-identifier hs-var">envUniqMeta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM Unique MetaId
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span>
</span><span id="line-380"></span><span>                      </span><span class="hs-special">}</span><span>
</span><span id="line-381"></span><span>
</span><span id="line-382"></span><span class="hs-comment">-- | Get environment (internal)</span><span>
</span><span id="line-383"></span><span id="local-6989586621681011842"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-type">getEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-type">LlvmEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681011842"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011842"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-384"></span><span id="getEnv"><span class="annot"><span class="annottext">getEnv :: forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var hs-var">getEnv</span></a></span></span><span> </span><span id="local-6989586621681011310"><span class="annot"><span class="annottext">LlvmEnv -&gt; a
</span><a href="#local-6989586621681011310"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681011309"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011309"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, LlvmEnv) -&gt; IO (a, LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; a
</span><a href="#local-6989586621681011310"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011309"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011309"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-385"></span><span>
</span><span id="line-386"></span><span class="hs-comment">-- | Modify environment (internal)</span><span>
</span><span id="line-387"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-type">modifyEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-type">LlvmEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmEnv"><span class="hs-identifier hs-type">LlvmEnv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-388"></span><span id="modifyEnv"><span class="annot"><span class="annottext">modifyEnv :: (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var hs-var">modifyEnv</span></a></span></span><span> </span><span id="local-6989586621681011307"><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnv
</span><a href="#local-6989586621681011307"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO ((), LlvmEnv)) -&gt; LlvmM ()
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681011306"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011306"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">((), LlvmEnv) -&gt; IO ((), LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnv
</span><a href="#local-6989586621681011307"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011306"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-389"></span><span>
</span><span id="line-390"></span><span class="hs-comment">-- | Lift a stream into the LlvmM monad</span><span>
</span><span id="line-391"></span><span id="local-6989586621681011832"><span id="local-6989586621681011833"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#liftStream"><span class="hs-identifier hs-type">liftStream</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Stream.html#Stream"><span class="hs-identifier hs-type">Stream.Stream</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681011833"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011832"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Stream.html#Stream"><span class="hs-identifier hs-type">Stream.Stream</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011833"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011832"><span class="hs-identifier hs-type">x</span></a></span></span></span><span>
</span><span id="line-392"></span><span id="liftStream"><span class="annot"><span class="annottext">liftStream :: forall a x. Stream IO a x -&gt; Stream LlvmM a x
</span><a href="GHC.CmmToLlvm.Base.html#liftStream"><span class="hs-identifier hs-var hs-var">liftStream</span></a></span></span><span> </span><span id="local-6989586621681011302"><span class="annot"><span class="annottext">Stream IO a x
</span><a href="#local-6989586621681011302"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmM (Either x (a, Stream LlvmM a x)) -&gt; Stream LlvmM a x
forall (m :: * -&gt; *) a b.
m (Either b (a, Stream m a b)) -&gt; Stream m a b
</span><a href="GHC.Data.Stream.html#Stream"><span class="hs-identifier hs-var">Stream.Stream</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmM (Either x (a, Stream LlvmM a x)) -&gt; Stream LlvmM a x)
-&gt; LlvmM (Either x (a, Stream LlvmM a x)) -&gt; Stream LlvmM a x
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-393"></span><span>  </span><span id="local-6989586621681011300"><span class="annot"><span class="annottext">Either x (a, Stream IO a x)
</span><a href="#local-6989586621681011300"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (Either x (a, Stream IO a x))
-&gt; LlvmM (Either x (a, Stream IO a x))
forall a. IO a -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Either x (a, Stream IO a x))
 -&gt; LlvmM (Either x (a, Stream IO a x)))
-&gt; IO (Either x (a, Stream IO a x))
-&gt; LlvmM (Either x (a, Stream IO a x))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Stream IO a x -&gt; IO (Either x (a, Stream IO a x))
forall (m :: * -&gt; *) a b.
Stream m a b -&gt; m (Either b (a, Stream m a b))
</span><a href="GHC.Data.Stream.html#runStream"><span class="hs-identifier hs-var hs-var">Stream.runStream</span></a></span><span> </span><span class="annot"><span class="annottext">Stream IO a x
</span><a href="#local-6989586621681011302"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-394"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either x (a, Stream IO a x)
</span><a href="#local-6989586621681011300"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-395"></span><span>    </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621681011298"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621681011298"><span class="hs-identifier hs-var">b</span></a></span></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either x (a, Stream LlvmM a x)
-&gt; LlvmM (Either x (a, Stream LlvmM a x))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">x -&gt; Either x (a, Stream LlvmM a x)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621681011298"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span>    </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681011297"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011297"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681011296"><span class="annot"><span class="annottext">Stream IO a x
</span><a href="#local-6989586621681011296"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either x (a, Stream LlvmM a x)
-&gt; LlvmM (Either x (a, Stream LlvmM a x))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a, Stream LlvmM a x) -&gt; Either x (a, Stream LlvmM a x)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011297"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Stream IO a x -&gt; Stream LlvmM a x
forall a x. Stream IO a x -&gt; Stream LlvmM a x
</span><a href="GHC.CmmToLlvm.Base.html#liftStream"><span class="hs-identifier hs-var">liftStream</span></a></span><span> </span><span class="annot"><span class="annottext">Stream IO a x
</span><a href="#local-6989586621681011296"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-397"></span><span>
</span><span id="line-398"></span><span class="hs-comment">-- | Clear variables from the environment for a subcomputation</span><span>
</span><span id="line-399"></span><span id="local-6989586621681011823"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#withClearVars"><span class="hs-identifier hs-type">withClearVars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011823"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011823"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-400"></span><span id="withClearVars"><span class="annot"><span class="annottext">withClearVars :: forall a. LlvmM a -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#withClearVars"><span class="hs-identifier hs-var hs-var">withClearVars</span></a></span></span><span> </span><span id="local-6989586621681011293"><span class="annot"><span class="annottext">LlvmM a
</span><a href="#local-6989586621681011293"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a)
-&gt; (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011292"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011292"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-401"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681011291"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011291"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681011290"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011290"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
forall a. LlvmM a -&gt; LlvmEnv -&gt; IO (a, LlvmEnv)
</span><a href="GHC.CmmToLlvm.Base.html#runLlvmM"><span class="hs-identifier hs-var hs-var">runLlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmM a
</span><a href="#local-6989586621681011293"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011292"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envVarMap :: LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envVarMap"><span class="hs-identifier hs-var">envVarMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envStackRegs :: LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#envStackRegs"><span class="hs-identifier hs-var">envStackRegs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-402"></span><span>    </span><span class="annot"><span class="annottext">(a, LlvmEnv) -&gt; IO (a, LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681011291"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011290"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envVarMap :: LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envVarMap"><span class="hs-identifier hs-var">envVarMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">envStackRegs :: LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#envStackRegs"><span class="hs-identifier hs-var">envStackRegs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="hs-comment">-- | Insert variables or functions into the environment.</span><span>
</span><span id="line-405"></span><span id="local-6989586621681011821"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#varInsert"><span class="hs-identifier hs-type">varInsert</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#funInsert"><span class="hs-identifier hs-type">funInsert</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011821"><span class="hs-identifier hs-type">key</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681011821"><span class="hs-identifier hs-type">key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-406"></span><span id="varInsert"><span class="annot"><span class="annottext">varInsert :: forall key. Uniquable key =&gt; key -&gt; LlvmType -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#varInsert"><span class="hs-identifier hs-var hs-var">varInsert</span></a></span></span><span> </span><span id="local-6989586621681011286"><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011286"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621681011285"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011285"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var">modifyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ())
-&gt; (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011284"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011284"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011284"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envVarMap :: LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envVarMap"><span class="hs-identifier hs-var">envVarMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap -&gt; Unique -&gt; LlvmType -&gt; LlvmEnvMap
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envVarMap"><span class="hs-identifier hs-var hs-var">envVarMap</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011284"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">key -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011286"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011285"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-407"></span><span id="funInsert"><span class="annot"><span class="annottext">funInsert :: forall key. Uniquable key =&gt; key -&gt; LlvmType -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#funInsert"><span class="hs-identifier hs-var hs-var">funInsert</span></a></span></span><span> </span><span id="local-6989586621681011278"><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011278"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621681011277"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011277"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var">modifyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ())
-&gt; (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011276"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011276"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011276"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envFunMap :: LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envFunMap"><span class="hs-identifier hs-var">envFunMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap -&gt; Unique -&gt; LlvmType -&gt; LlvmEnvMap
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envFunMap"><span class="hs-identifier hs-var hs-var">envFunMap</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011276"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">key -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011278"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011277"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-408"></span><span>
</span><span id="line-409"></span><span class="hs-comment">-- | Lookup variables or functions in the environment.</span><span>
</span><span id="line-410"></span><span id="local-6989586621681011815"><span class="annot"><a href="GHC.CmmToLlvm.Base.html#varLookup"><span class="hs-identifier hs-type">varLookup</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#funLookup"><span class="hs-identifier hs-type">funLookup</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681011815"><span class="hs-identifier hs-type">key</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681011815"><span class="hs-identifier hs-type">key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-411"></span><span id="varLookup"><span class="annot"><span class="annottext">varLookup :: forall key. Uniquable key =&gt; key -&gt; LlvmM (Maybe LlvmType)
</span><a href="GHC.CmmToLlvm.Base.html#varLookup"><span class="hs-identifier hs-var hs-var">varLookup</span></a></span></span><span> </span><span id="local-6989586621681011272"><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011272"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; Maybe LlvmType) -&gt; LlvmM (Maybe LlvmType)
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LlvmEnvMap -&gt; Unique -&gt; Maybe LlvmType)
-&gt; Unique -&gt; LlvmEnvMap -&gt; Maybe LlvmType
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap -&gt; Unique -&gt; Maybe LlvmType
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">key -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011272"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(LlvmEnvMap -&gt; Maybe LlvmType)
-&gt; (LlvmEnv -&gt; LlvmEnvMap) -&gt; LlvmEnv -&gt; Maybe LlvmType
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envVarMap"><span class="hs-identifier hs-var hs-var">envVarMap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-412"></span><span id="funLookup"><span class="annot"><span class="annottext">funLookup :: forall key. Uniquable key =&gt; key -&gt; LlvmM (Maybe LlvmType)
</span><a href="GHC.CmmToLlvm.Base.html#funLookup"><span class="hs-identifier hs-var hs-var">funLookup</span></a></span></span><span> </span><span id="local-6989586621681011266"><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011266"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; Maybe LlvmType) -&gt; LlvmM (Maybe LlvmType)
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LlvmEnvMap -&gt; Unique -&gt; Maybe LlvmType)
-&gt; Unique -&gt; LlvmEnvMap -&gt; Maybe LlvmType
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnvMap -&gt; Unique -&gt; Maybe LlvmType
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">key -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">key
</span><a href="#local-6989586621681011266"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(LlvmEnvMap -&gt; Maybe LlvmType)
-&gt; (LlvmEnv -&gt; LlvmEnvMap) -&gt; LlvmEnv -&gt; Maybe LlvmType
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmEnvMap
</span><a href="GHC.CmmToLlvm.Base.html#envFunMap"><span class="hs-identifier hs-var hs-var">envFunMap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-413"></span><span>
</span><span id="line-414"></span><span class="hs-comment">-- | Set a register as allocated on the stack</span><span>
</span><span id="line-415"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#markStackReg"><span class="hs-identifier hs-type">markStackReg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-416"></span><span id="markStackReg"><span class="annot"><span class="annottext">markStackReg :: GlobalReg -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#markStackReg"><span class="hs-identifier hs-var hs-var">markStackReg</span></a></span></span><span> </span><span id="local-6989586621681011265"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011265"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var">modifyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ())
-&gt; (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011264"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011264"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011264"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envStackRegs :: LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#envStackRegs"><span class="hs-identifier hs-var">envStackRegs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011265"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg -&gt; LiveGlobalRegs -&gt; LiveGlobalRegs
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#envStackRegs"><span class="hs-identifier hs-var hs-var">envStackRegs</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011264"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span class="hs-comment">-- | Check whether a register is allocated on the stack</span><span>
</span><span id="line-419"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#checkStackReg"><span class="hs-identifier hs-type">checkStackReg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.Expr.html#GlobalReg"><span class="hs-identifier hs-type">GlobalReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-420"></span><span id="checkStackReg"><span class="annot"><span class="annottext">checkStackReg :: GlobalReg -&gt; LlvmM Bool
</span><a href="GHC.CmmToLlvm.Base.html#checkStackReg"><span class="hs-identifier hs-var hs-var">checkStackReg</span></a></span></span><span> </span><span id="local-6989586621681011263"><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011263"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; Bool) -&gt; LlvmM Bool
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalReg -&gt; LiveGlobalRegs -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-identifier hs-var">elem</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalReg
</span><a href="#local-6989586621681011263"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(LiveGlobalRegs -&gt; Bool)
-&gt; (LlvmEnv -&gt; LiveGlobalRegs) -&gt; LlvmEnv -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; LiveGlobalRegs
</span><a href="GHC.CmmToLlvm.Base.html#envStackRegs"><span class="hs-identifier hs-var hs-var">envStackRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span class="hs-comment">-- | Allocate a new global unnamed metadata identifier</span><span>
</span><span id="line-423"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getMetaUniqueId"><span class="hs-identifier hs-type">getMetaUniqueId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaId"><span class="hs-identifier hs-type">MetaId</span></a></span><span>
</span><span id="line-424"></span><span id="getMetaUniqueId"><span class="annot"><span class="annottext">getMetaUniqueId :: LlvmM MetaId
</span><a href="GHC.CmmToLlvm.Base.html#getMetaUniqueId"><span class="hs-identifier hs-var hs-var">getMetaUniqueId</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; IO (MetaId, LlvmEnv)) -&gt; LlvmM MetaId
forall a. (LlvmEnv -&gt; IO (a, LlvmEnv)) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-var">LlvmM</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; IO (MetaId, LlvmEnv)) -&gt; LlvmM MetaId)
-&gt; (LlvmEnv -&gt; IO (MetaId, LlvmEnv)) -&gt; LlvmM MetaId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011262"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011262"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-425"></span><span>    </span><span class="annot"><span class="annottext">(MetaId, LlvmEnv) -&gt; IO (MetaId, LlvmEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envFreshMeta"><span class="hs-identifier hs-var hs-var">envFreshMeta</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011262"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011262"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envFreshMeta :: MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envFreshMeta"><span class="hs-identifier hs-var">envFreshMeta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MetaId -&gt; MetaId
forall a. Enum a =&gt; a -&gt; a
</span><a href="../../base/src/GHC.Enum.html#succ"><span class="hs-identifier hs-var">succ</span></a></span><span> </span><span class="annot"><span class="annottext">(MetaId -&gt; MetaId) -&gt; MetaId -&gt; MetaId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envFreshMeta"><span class="hs-identifier hs-var hs-var">envFreshMeta</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011262"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-426"></span><span>
</span><span id="line-427"></span><span class="hs-comment">-- | Get the LLVM version we are generating code for</span><span>
</span><span id="line-428"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getLlvmVer"><span class="hs-identifier hs-type">getLlvmVer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmVersion"><span class="hs-identifier hs-type">LlvmVersion</span></a></span><span>
</span><span id="line-429"></span><span id="getLlvmVer"><span class="annot"><span class="annottext">getLlvmVer :: LlvmM LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#getLlvmVer"><span class="hs-identifier hs-var hs-var">getLlvmVer</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmVersion) -&gt; LlvmM LlvmVersion
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; LlvmVersion
</span><a href="GHC.CmmToLlvm.Base.html#envVersion"><span class="hs-identifier hs-var hs-var">envVersion</span></a></span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span class="hs-comment">-- | Dumps the document if the corresponding flag has been set by the user</span><span>
</span><span id="line-432"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#dumpIfSetLlvm"><span class="hs-identifier hs-type">dumpIfSetLlvm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#DumpFlag"><span class="hs-identifier hs-type">DumpFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#DumpFormat"><span class="hs-identifier hs-type">DumpFormat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">Outp.SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-433"></span><span id="dumpIfSetLlvm"><span class="annot"><span class="annottext">dumpIfSetLlvm :: DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#dumpIfSetLlvm"><span class="hs-identifier hs-var hs-var">dumpIfSetLlvm</span></a></span></span><span> </span><span id="local-6989586621681011260"><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681011260"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681011259"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011259"><span class="hs-identifier hs-var">hdr</span></a></span></span><span> </span><span id="local-6989586621681011258"><span class="annot"><span class="annottext">DumpFormat
</span><a href="#local-6989586621681011258"><span class="hs-identifier hs-var">fmt</span></a></span></span><span> </span><span id="local-6989586621681011257"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681011257"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-434"></span><span>  </span><span id="local-6989586621681011256"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011256"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-435"></span><span>  </span><span class="annot"><span class="annottext">IO () -&gt; LlvmM ()
forall a. IO a -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; LlvmM ()) -&gt; IO () -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#dumpIfSet_dyn"><span class="hs-identifier hs-var">dumpIfSet_dyn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011256"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681011260"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011259"><span class="hs-identifier hs-var">hdr</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="#local-6989586621681011258"><span class="hs-identifier hs-var">fmt</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681011257"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-436"></span><span>
</span><span id="line-437"></span><span class="hs-comment">-- | Prints the given contents to the output handle</span><span>
</span><span id="line-438"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#renderLlvm"><span class="hs-identifier hs-type">renderLlvm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">Outp.SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-439"></span><span id="renderLlvm"><span class="annot"><span class="annottext">renderLlvm :: SDoc -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#renderLlvm"><span class="hs-identifier hs-var hs-var">renderLlvm</span></a></span></span><span> </span><span id="local-6989586621681011254"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681011254"><span class="hs-identifier hs-var">sdoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-440"></span><span>
</span><span id="line-441"></span><span>    </span><span class="hs-comment">-- Write to output</span><span>
</span><span id="line-442"></span><span>    </span><span id="local-6989586621681011253"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011253"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-443"></span><span>    </span><span id="local-6989586621681011252"><span class="annot"><span class="annottext">BufHandle
</span><a href="#local-6989586621681011252"><span class="hs-identifier hs-var">out</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; BufHandle) -&gt; LlvmM BufHandle
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; BufHandle
</span><a href="GHC.CmmToLlvm.Base.html#envOutput"><span class="hs-identifier hs-var hs-var">envOutput</span></a></span><span>
</span><span id="line-444"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011251"><span class="annot"><span class="annottext">ctx :: SDocContext
</span><a href="#local-6989586621681011251"><span class="hs-identifier hs-var hs-var">ctx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; PprStyle -&gt; SDocContext
</span><a href="GHC.Driver.Session.html#initSDocContext"><span class="hs-identifier hs-var">initSDocContext</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011253"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CodeStyle -&gt; PprStyle
</span><a href="GHC.Utils.Outputable.html#mkCodeStyle"><span class="hs-identifier hs-var">Outp.mkCodeStyle</span></a></span><span> </span><span class="annot"><span class="annottext">CodeStyle
</span><a href="GHC.Utils.Outputable.html#CStyle"><span class="hs-identifier hs-var">Outp.CStyle</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-445"></span><span>    </span><span class="annot"><span class="annottext">IO () -&gt; LlvmM ()
forall a. IO a -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; LlvmM ()) -&gt; IO () -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SDocContext -&gt; BufHandle -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Outputable.html#bufLeftRenderSDoc"><span class="hs-identifier hs-var">Outp.bufLeftRenderSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">SDocContext
</span><a href="#local-6989586621681011251"><span class="hs-identifier hs-var">ctx</span></a></span><span> </span><span class="annot"><span class="annottext">BufHandle
</span><a href="#local-6989586621681011252"><span class="hs-identifier hs-var">out</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681011254"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-446"></span><span>
</span><span id="line-447"></span><span>    </span><span class="hs-comment">-- Dump, if requested</span><span>
</span><span id="line-448"></span><span>    </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#dumpIfSetLlvm"><span class="hs-identifier hs-var">dumpIfSetLlvm</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_llvm"><span class="hs-identifier hs-var">Opt_D_dump_llvm</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LLVM Code&quot;</span></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatLLVM"><span class="hs-identifier hs-var">FormatLLVM</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681011254"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-449"></span><span>    </span><span class="annot"><span class="annottext">() -&gt; LlvmM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-comment">-- | Marks a variable as &quot;used&quot;</span><span>
</span><span id="line-452"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#markUsedVar"><span class="hs-identifier hs-type">markUsedVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmVar"><span class="hs-identifier hs-type">LlvmVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-453"></span><span id="markUsedVar"><span class="annot"><span class="annottext">markUsedVar :: LlvmVar -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#markUsedVar"><span class="hs-identifier hs-var hs-var">markUsedVar</span></a></span></span><span> </span><span id="local-6989586621681011244"><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011244"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var">modifyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ())
-&gt; (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011243"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011243"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011243"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envUsedVars :: [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#envUsedVars"><span class="hs-identifier hs-var">envUsedVars</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011244"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; [LlvmVar] -&gt; [LlvmVar]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#envUsedVars"><span class="hs-identifier hs-var hs-var">envUsedVars</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011243"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-454"></span><span>
</span><span id="line-455"></span><span class="hs-comment">-- | Return all variables marked as &quot;used&quot; so far</span><span>
</span><span id="line-456"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getUsedVars"><span class="hs-identifier hs-type">getUsedVars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmVar"><span class="hs-identifier hs-type">LlvmVar</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-457"></span><span id="getUsedVars"><span class="annot"><span class="annottext">getUsedVars :: LlvmM [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#getUsedVars"><span class="hs-identifier hs-var hs-var">getUsedVars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; [LlvmVar]) -&gt; LlvmM [LlvmVar]
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; [LlvmVar]
</span><a href="GHC.CmmToLlvm.Base.html#envUsedVars"><span class="hs-identifier hs-var hs-var">envUsedVars</span></a></span><span>
</span><span id="line-458"></span><span>
</span><span id="line-459"></span><span class="hs-comment">-- | Saves that at some point we didn't know the type of the label and</span><span>
</span><span id="line-460"></span><span class="hs-comment">-- generated a reference to a type variable instead</span><span>
</span><span id="line-461"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#saveAlias"><span class="hs-identifier hs-type">saveAlias</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-462"></span><span id="saveAlias"><span class="annot"><span class="annottext">saveAlias :: LMString -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#saveAlias"><span class="hs-identifier hs-var hs-var">saveAlias</span></a></span></span><span> </span><span id="local-6989586621681011241"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011241"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var">modifyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ())
-&gt; (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011240"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011240"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011240"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envAliases :: UniqSet LMString
</span><a href="GHC.CmmToLlvm.Base.html#envAliases"><span class="hs-identifier hs-var">envAliases</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet LMString -&gt; LMString -&gt; UniqSet LMString
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#addOneToUniqSet"><span class="hs-identifier hs-var">addOneToUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; UniqSet LMString
</span><a href="GHC.CmmToLlvm.Base.html#envAliases"><span class="hs-identifier hs-var hs-var">envAliases</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011240"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011241"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-463"></span><span>
</span><span id="line-464"></span><span class="hs-comment">-- | Sets metadata node for a given unique</span><span>
</span><span id="line-465"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#setUniqMeta"><span class="hs-identifier hs-type">setUniqMeta</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaId"><span class="hs-identifier hs-type">MetaId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span id="setUniqMeta"><span class="annot"><span class="annottext">setUniqMeta :: Unique -&gt; MetaId -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#setUniqMeta"><span class="hs-identifier hs-var hs-var">setUniqMeta</span></a></span></span><span> </span><span id="local-6989586621681011238"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681011238"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621681011237"><span class="annot"><span class="annottext">MetaId
</span><a href="#local-6989586621681011237"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var">modifyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ())
-&gt; (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011236"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011236"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011236"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envUniqMeta :: UniqFM Unique MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envUniqMeta"><span class="hs-identifier hs-var">envUniqMeta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM Unique MetaId -&gt; Unique -&gt; MetaId -&gt; UniqFM Unique MetaId
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmEnv -&gt; UniqFM Unique MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envUniqMeta"><span class="hs-identifier hs-var hs-var">envUniqMeta</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011236"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681011238"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">MetaId
</span><a href="#local-6989586621681011237"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span class="hs-comment">-- | Gets metadata node for given unique</span><span>
</span><span id="line-469"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getUniqMeta"><span class="hs-identifier hs-type">getUniqMeta</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.MetaData.html#MetaId"><span class="hs-identifier hs-type">MetaId</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-470"></span><span id="getUniqMeta"><span class="annot"><span class="annottext">getUniqMeta :: Unique -&gt; LlvmM (Maybe MetaId)
</span><a href="GHC.CmmToLlvm.Base.html#getUniqMeta"><span class="hs-identifier hs-var hs-var">getUniqMeta</span></a></span></span><span> </span><span id="local-6989586621681011235"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681011235"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; Maybe MetaId) -&gt; LlvmM (Maybe MetaId)
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(UniqFM Unique MetaId -&gt; Unique -&gt; Maybe MetaId)
-&gt; Unique -&gt; UniqFM Unique MetaId -&gt; Maybe MetaId
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM Unique MetaId -&gt; Unique -&gt; Maybe MetaId
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681011235"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM Unique MetaId -&gt; Maybe MetaId)
-&gt; (LlvmEnv -&gt; UniqFM Unique MetaId) -&gt; LlvmEnv -&gt; Maybe MetaId
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; UniqFM Unique MetaId
</span><a href="GHC.CmmToLlvm.Base.html#envUniqMeta"><span class="hs-identifier hs-var hs-var">envUniqMeta</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-471"></span><span>
</span><span id="line-472"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-473"></span><span class="hs-comment">-- * Internal functions</span><span>
</span><span id="line-474"></span><span class="hs-comment">--</span><span>
</span><span id="line-475"></span><span>
</span><span id="line-476"></span><span class="hs-comment">-- | Here we pre-initialise some functions that are used internally by GHC</span><span>
</span><span id="line-477"></span><span class="hs-comment">-- so as to make sure they have the most general type in the case that</span><span>
</span><span id="line-478"></span><span class="hs-comment">-- user code also uses these functions but with a different type than GHC</span><span>
</span><span id="line-479"></span><span class="hs-comment">-- internally. (Main offender is treating return type as 'void' instead of</span><span>
</span><span id="line-480"></span><span class="hs-comment">-- 'void *'). Fixes trac #5486.</span><span>
</span><span id="line-481"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#ghcInternalFunctions"><span class="hs-identifier hs-type">ghcInternalFunctions</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-482"></span><span id="ghcInternalFunctions"><span class="annot"><span class="annottext">ghcInternalFunctions :: LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#ghcInternalFunctions"><span class="hs-identifier hs-var hs-var">ghcInternalFunctions</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-483"></span><span>    </span><span id="local-6989586621681011234"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011234"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM Platform
</span><a href="GHC.CmmToLlvm.Base.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-484"></span><span>    </span><span id="local-6989586621681011233"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011233"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-485"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011232"><span class="annot"><span class="annottext">w :: LlvmType
</span><a href="#local-6989586621681011232"><span class="hs-identifier hs-var hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#llvmWord"><span class="hs-identifier hs-var">llvmWord</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681011234"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-486"></span><span>        </span><span id="local-6989586621681011230"><span class="annot"><span class="annottext">cint :: LlvmType
</span><a href="#local-6989586621681011230"><span class="hs-identifier hs-var hs-var">cint</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#LMInt"><span class="hs-identifier hs-var">LMInt</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; LlvmType) -&gt; Int -&gt; LlvmType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Width -&gt; Int
</span><a href="GHC.Cmm.Type.html#widthInBits"><span class="hs-identifier hs-var">widthInBits</span></a></span><span> </span><span class="annot"><span class="annottext">(Width -&gt; Int) -&gt; Width -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Width
</span><a href="GHC.Cmm.Type.html#cIntWidth"><span class="hs-identifier hs-var">cIntWidth</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011233"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-487"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; LlvmType -&gt; [LlvmType] -&gt; LlvmM ()
</span><a href="#local-6989586621681011228"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memcmp&quot;</span></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011230"><span class="hs-identifier hs-var">cint</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011232"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-488"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; LlvmType -&gt; [LlvmType] -&gt; LlvmM ()
</span><a href="#local-6989586621681011228"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memcpy&quot;</span></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011232"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-489"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; LlvmType -&gt; [LlvmType] -&gt; LlvmM ()
</span><a href="#local-6989586621681011228"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memmove&quot;</span></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011232"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-490"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; LlvmType -&gt; [LlvmType] -&gt; LlvmM ()
</span><a href="#local-6989586621681011228"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memset&quot;</span></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011232"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011232"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-491"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; LlvmType -&gt; [LlvmType] -&gt; LlvmM ()
</span><a href="#local-6989586621681011228"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newSpark&quot;</span></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011232"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-492"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-493"></span><span>    </span><span id="local-6989586621681011228"><span class="annot"><span class="annottext">mk :: String -&gt; LlvmType -&gt; [LlvmType] -&gt; LlvmM ()
</span><a href="#local-6989586621681011228"><span class="hs-identifier hs-var hs-var">mk</span></a></span></span><span> </span><span id="local-6989586621681011224"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011224"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681011223"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011223"><span class="hs-identifier hs-var">ret</span></a></span></span><span> </span><span id="local-6989586621681011222"><span class="annot"><span class="annottext">[LlvmType]
</span><a href="#local-6989586621681011222"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-494"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011221"><span class="annot"><span class="annottext">n' :: LMString
</span><a href="#local-6989586621681011221"><span class="hs-identifier hs-var hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; LMString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011224"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-495"></span><span>          </span><span id="local-6989586621681011220"><span class="annot"><span class="annottext">decl :: LlvmFunctionDecl
</span><a href="#local-6989586621681011220"><span class="hs-identifier hs-var hs-var">decl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString
-&gt; LlvmLinkageType
-&gt; LlvmCallConvention
-&gt; LlvmType
-&gt; LlvmParameterListType
-&gt; [(LlvmType, [LlvmParamAttr])]
-&gt; LMAlign
-&gt; LlvmFunctionDecl
</span><a href="GHC.Llvm.Types.html#LlvmFunctionDecl"><span class="hs-identifier hs-var">LlvmFunctionDecl</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011221"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="GHC.Llvm.Types.html#ExternallyVisible"><span class="hs-identifier hs-var">ExternallyVisible</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmCallConvention
</span><a href="GHC.Llvm.Types.html#CC_Ccc"><span class="hs-identifier hs-var">CC_Ccc</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011223"><span class="hs-identifier hs-var">ret</span></a></span><span>
</span><span id="line-496"></span><span>                                 </span><span class="annot"><span class="annottext">LlvmParameterListType
</span><a href="GHC.Llvm.Types.html#FixedArgs"><span class="hs-identifier hs-var">FixedArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LlvmType] -&gt; [(LlvmType, [LlvmParamAttr])]
</span><a href="GHC.CmmToLlvm.Base.html#tysToParams"><span class="hs-identifier hs-var">tysToParams</span></a></span><span> </span><span class="annot"><span class="annottext">[LlvmType]
</span><a href="#local-6989586621681011222"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LMAlign
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-497"></span><span>      </span><span class="annot"><span class="annottext">SDoc -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#renderLlvm"><span class="hs-identifier hs-var">renderLlvm</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; LlvmM ()) -&gt; SDoc -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmFunctionDecl -&gt; SDoc
</span><a href="GHC.Llvm.Ppr.html#ppLlvmFunctionDecl"><span class="hs-identifier hs-var">ppLlvmFunctionDecl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmFunctionDecl
</span><a href="#local-6989586621681011220"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-498"></span><span>      </span><span class="annot"><span class="annottext">LMString -&gt; LlvmType -&gt; LlvmM ()
forall key. Uniquable key =&gt; key -&gt; LlvmType -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#funInsert"><span class="hs-identifier hs-var">funInsert</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011221"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmFunctionDecl -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#LMFunction"><span class="hs-identifier hs-var">LMFunction</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmFunctionDecl
</span><a href="#local-6989586621681011220"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-499"></span><span>
</span><span id="line-500"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-501"></span><span class="hs-comment">-- * Label handling</span><span>
</span><span id="line-502"></span><span class="hs-comment">--</span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span class="hs-comment">-- | Pretty print a 'CLabel'.</span><span>
</span><span id="line-505"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#strCLabel_llvm"><span class="hs-identifier hs-type">strCLabel_llvm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.CLabel.html#CLabel"><span class="hs-identifier hs-type">CLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span>
</span><span id="line-506"></span><span id="strCLabel_llvm"><span class="annot"><span class="annottext">strCLabel_llvm :: CLabel -&gt; LlvmM LMString
</span><a href="GHC.CmmToLlvm.Base.html#strCLabel_llvm"><span class="hs-identifier hs-var hs-var">strCLabel_llvm</span></a></span></span><span> </span><span id="local-6989586621681011218"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681011218"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-507"></span><span>    </span><span id="local-6989586621681011217"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011217"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LlvmM DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-508"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011216"><span class="annot"><span class="annottext">sdoc :: SDoc
</span><a href="#local-6989586621681011216"><span class="hs-identifier hs-var hs-var">sdoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; CLabel -&gt; SDoc
</span><a href="GHC.Cmm.CLabel.html#pprCLabel"><span class="hs-identifier hs-var">pprCLabel</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011217"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681011218"><span class="hs-identifier hs-var">lbl</span></a></span><span>
</span><span id="line-509"></span><span>        </span><span id="local-6989586621681011214"><span class="annot"><span class="annottext">str :: String
</span><a href="#local-6989586621681011214"><span class="hs-identifier hs-var hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDocContext -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#renderWithStyle"><span class="hs-identifier hs-var">Outp.renderWithStyle</span></a></span><span>
</span><span id="line-510"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; PprStyle -&gt; SDocContext
</span><a href="GHC.Driver.Session.html#initSDocContext"><span class="hs-identifier hs-var">initSDocContext</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681011217"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CodeStyle -&gt; PprStyle
</span><a href="GHC.Utils.Outputable.html#mkCodeStyle"><span class="hs-identifier hs-var">Outp.mkCodeStyle</span></a></span><span> </span><span class="annot"><span class="annottext">CodeStyle
</span><a href="GHC.Utils.Outputable.html#CStyle"><span class="hs-identifier hs-var">Outp.CStyle</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-511"></span><span>                  </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681011216"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-512"></span><span>    </span><span class="annot"><span class="annottext">LMString -&gt; LlvmM LMString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; LMString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681011214"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-513"></span><span>
</span><span id="line-514"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-515"></span><span class="hs-comment">-- * Global variables / forward references</span><span>
</span><span id="line-516"></span><span class="hs-comment">--</span><span>
</span><span id="line-517"></span><span>
</span><span id="line-518"></span><span class="hs-comment">-- | Create/get a pointer to a global value. Might return an alias if</span><span>
</span><span id="line-519"></span><span class="hs-comment">-- the value in question hasn't been defined yet. We especially make</span><span>
</span><span id="line-520"></span><span class="hs-comment">-- no guarantees on the type of the returned pointer.</span><span>
</span><span id="line-521"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#getGlobalPtr"><span class="hs-identifier hs-type">getGlobalPtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmVar"><span class="hs-identifier hs-type">LlvmVar</span></a></span><span>
</span><span id="line-522"></span><span id="getGlobalPtr"><span class="annot"><span class="annottext">getGlobalPtr :: LMString -&gt; LlvmM LlvmVar
</span><a href="GHC.CmmToLlvm.Base.html#getGlobalPtr"><span class="hs-identifier hs-var hs-var">getGlobalPtr</span></a></span></span><span> </span><span id="local-6989586621681011212"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011212"><span class="hs-identifier hs-var">llvmLbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-523"></span><span>  </span><span id="local-6989586621681011211"><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="#local-6989586621681011211"><span class="hs-identifier hs-var">m_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LlvmM (Maybe LlvmType)
forall key. Uniquable key =&gt; key -&gt; LlvmM (Maybe LlvmType)
</span><a href="GHC.CmmToLlvm.Base.html#funLookup"><span class="hs-identifier hs-var">funLookup</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011212"><span class="hs-identifier hs-var">llvmLbl</span></a></span><span>
</span><span id="line-524"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011210"><span class="annot"><span class="annottext">mkGlbVar :: LMString -&gt; LlvmType -&gt; LMConst -&gt; LlvmVar
</span><a href="#local-6989586621681011210"><span class="hs-identifier hs-var hs-var">mkGlbVar</span></a></span></span><span> </span><span id="local-6989586621681011209"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011209"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681011208"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011208"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011209"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#LMPointer"><span class="hs-identifier hs-var">LMPointer</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011208"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="GHC.Llvm.Types.html#Private"><span class="hs-identifier hs-var">Private</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-525"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="#local-6989586621681011211"><span class="hs-identifier hs-var">m_ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-526"></span><span>    </span><span class="hs-comment">-- Directly reference if we have seen it already</span><span>
</span><span id="line-527"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681011204"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011204"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-528"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011212"><span class="hs-identifier hs-var">llvmLbl</span></a></span><span> </span><span class="annot"><span class="annottext">LMString -&gt; [LMString] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; LMString) -&gt; [String] -&gt; [LMString]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LMString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newSpark&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memmove&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memcpy&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memcmp&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;memset&quot;</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-529"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmM LlvmVar
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmVar -&gt; LlvmM LlvmVar) -&gt; LlvmVar -&gt; LlvmM LlvmVar
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LlvmType -&gt; LMConst -&gt; LlvmVar
</span><a href="#local-6989586621681011210"><span class="hs-identifier hs-var">mkGlbVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011212"><span class="hs-identifier hs-var">llvmLbl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011204"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Global"><span class="hs-identifier hs-var">Global</span></a></span><span>
</span><span id="line-530"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmM LlvmVar
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmVar -&gt; LlvmM LlvmVar) -&gt; LlvmVar -&gt; LlvmM LlvmVar
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LlvmType -&gt; LMConst -&gt; LlvmVar
</span><a href="#local-6989586621681011210"><span class="hs-identifier hs-var">mkGlbVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LMString -&gt; LMString
</span><a href="GHC.CmmToLlvm.Base.html#llvmDefLabel"><span class="hs-identifier hs-var">llvmDefLabel</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011212"><span class="hs-identifier hs-var">llvmLbl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011204"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Global"><span class="hs-identifier hs-var">Global</span></a></span><span>
</span><span id="line-531"></span><span>    </span><span class="hs-comment">-- Otherwise use a forward alias of it</span><span>
</span><span id="line-532"></span><span>    </span><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-533"></span><span>      </span><span class="annot"><span class="annottext">LMString -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#saveAlias"><span class="hs-identifier hs-var">saveAlias</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011212"><span class="hs-identifier hs-var">llvmLbl</span></a></span><span>
</span><span id="line-534"></span><span>      </span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmM LlvmVar
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmVar -&gt; LlvmM LlvmVar) -&gt; LlvmVar -&gt; LlvmM LlvmVar
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LlvmType -&gt; LMConst -&gt; LlvmVar
</span><a href="#local-6989586621681011210"><span class="hs-identifier hs-var">mkGlbVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011212"><span class="hs-identifier hs-var">llvmLbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8"><span class="hs-identifier hs-var">i8</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span>
</span><span id="line-535"></span><span>
</span><span id="line-536"></span><span class="hs-comment">-- | Derive the definition label. It has an identified</span><span>
</span><span id="line-537"></span><span class="hs-comment">-- structure type.</span><span>
</span><span id="line-538"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#llvmDefLabel"><span class="hs-identifier hs-type">llvmDefLabel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMString"><span class="hs-identifier hs-type">LMString</span></a></span><span>
</span><span id="line-539"></span><span id="llvmDefLabel"><span class="annot"><span class="annottext">llvmDefLabel :: LMString -&gt; LMString
</span><a href="GHC.CmmToLlvm.Base.html#llvmDefLabel"><span class="hs-identifier hs-var hs-var">llvmDefLabel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LMString -&gt; LMString -&gt; LMString
</span><a href="GHC.Data.FastString.html#appendFS"><span class="hs-operator hs-var">`appendFS`</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; LMString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;$def&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-540"></span><span>
</span><span id="line-541"></span><span class="hs-comment">-- | Generate definitions for aliases forward-referenced by @getGlobalPtr@.</span><span>
</span><span id="line-542"></span><span class="hs-comment">--</span><span>
</span><span id="line-543"></span><span class="hs-comment">-- Must be called at a point where we are sure that no new global definitions</span><span>
</span><span id="line-544"></span><span class="hs-comment">-- will be generated anymore!</span><span>
</span><span id="line-545"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#generateExternDecls"><span class="hs-identifier hs-type">generateExternDecls</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-type">LMGlobal</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LlvmType"><span class="hs-identifier hs-type">LlvmType</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-546"></span><span id="generateExternDecls"><span class="annot"><span class="annottext">generateExternDecls :: LlvmM ([LMGlobal], [LlvmType])
</span><a href="GHC.CmmToLlvm.Base.html#generateExternDecls"><span class="hs-identifier hs-var hs-var">generateExternDecls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-547"></span><span>  </span><span id="local-6989586621681011199"><span class="annot"><span class="annottext">[LMString]
</span><a href="#local-6989586621681011199"><span class="hs-identifier hs-var">delayed</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(UniqSet LMString -&gt; [LMString])
-&gt; LlvmM (UniqSet LMString) -&gt; LlvmM [LMString]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet LMString -&gt; [LMString]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmM (UniqSet LMString) -&gt; LlvmM [LMString])
-&gt; LlvmM (UniqSet LMString) -&gt; LlvmM [LMString]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; UniqSet LMString) -&gt; LlvmM (UniqSet LMString)
forall a. (LlvmEnv -&gt; a) -&gt; LlvmM a
</span><a href="GHC.CmmToLlvm.Base.html#getEnv"><span class="hs-identifier hs-var">getEnv</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmEnv -&gt; UniqSet LMString
</span><a href="GHC.CmmToLlvm.Base.html#envAliases"><span class="hs-identifier hs-var hs-var">envAliases</span></a></span><span>
</span><span id="line-548"></span><span>  </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-549"></span><span>  </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-550"></span><span>  </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-551"></span><span>  </span><span id="local-6989586621681011197"><span class="annot"><span class="annottext">[[LMGlobal]]
</span><a href="#local-6989586621681011197"><span class="hs-identifier hs-var">defss</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((LMString -&gt; LlvmM [LMGlobal])
 -&gt; [LMString] -&gt; LlvmM [[LMGlobal]])
-&gt; [LMString]
-&gt; (LMString -&gt; LlvmM [LMGlobal])
-&gt; LlvmM [[LMGlobal]]
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">(LMString -&gt; LlvmM [LMGlobal]) -&gt; [LMString] -&gt; LlvmM [[LMGlobal]]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">[LMString]
</span><a href="#local-6989586621681011199"><span class="hs-identifier hs-var">delayed</span></a></span><span> </span><span class="annot"><span class="annottext">((LMString -&gt; LlvmM [LMGlobal]) -&gt; LlvmM [[LMGlobal]])
-&gt; (LMString -&gt; LlvmM [LMGlobal]) -&gt; LlvmM [[LMGlobal]]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011195"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011195"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-552"></span><span>    </span><span id="local-6989586621681011194"><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="#local-6989586621681011194"><span class="hs-identifier hs-var">m_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LlvmM (Maybe LlvmType)
forall key. Uniquable key =&gt; key -&gt; LlvmM (Maybe LlvmType)
</span><a href="GHC.CmmToLlvm.Base.html#funLookup"><span class="hs-identifier hs-var">funLookup</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011195"><span class="hs-identifier hs-var">lbl</span></a></span><span>
</span><span id="line-553"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="#local-6989586621681011194"><span class="hs-identifier hs-var">m_ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-554"></span><span>      </span><span class="hs-comment">-- If we have a definition we've already emitted the proper aliases</span><span>
</span><span id="line-555"></span><span>      </span><span class="hs-comment">-- when the symbol itself was emitted by @aliasify@</span><span>
</span><span id="line-556"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[LMGlobal] -&gt; LlvmM [LMGlobal]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-557"></span><span>
</span><span id="line-558"></span><span>      </span><span class="hs-comment">-- If we don't have a definition this is an external symbol and we</span><span>
</span><span id="line-559"></span><span>      </span><span class="hs-comment">-- need to emit a declaration</span><span>
</span><span id="line-560"></span><span>      </span><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011193"><span class="annot"><span class="annottext">var :: LlvmVar
</span><a href="#local-6989586621681011193"><span class="hs-identifier hs-var hs-var">var</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011195"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="GHC.Llvm.Types.html#External"><span class="hs-identifier hs-var">External</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Global"><span class="hs-identifier hs-var">Global</span></a></span><span>
</span><span id="line-562"></span><span>        </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">[LMGlobal] -&gt; LlvmM [LMGlobal]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LlvmVar -&gt; Maybe LlvmStatic -&gt; LMGlobal
</span><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-var">LMGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011193"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LlvmStatic
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-563"></span><span>
</span><span id="line-564"></span><span>  </span><span class="hs-comment">-- Reset forward list</span><span>
</span><span id="line-565"></span><span>  </span><span class="annot"><span class="annottext">(LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#modifyEnv"><span class="hs-identifier hs-var">modifyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">((LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ())
-&gt; (LlvmEnv -&gt; LlvmEnv) -&gt; LlvmM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681011190"><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011190"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LlvmEnv
</span><a href="#local-6989586621681011190"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">envAliases :: UniqSet LMString
</span><a href="GHC.CmmToLlvm.Base.html#envAliases"><span class="hs-identifier hs-var">envAliases</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet LMString
forall a. UniqSet a
</span><a href="GHC.Types.Unique.Set.html#emptyUniqSet"><span class="hs-identifier hs-var">emptyUniqSet</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-566"></span><span>  </span><span class="annot"><span class="annottext">([LMGlobal], [LlvmType]) -&gt; LlvmM ([LMGlobal], [LlvmType])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[LMGlobal]] -&gt; [LMGlobal]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[LMGlobal]]
</span><a href="#local-6989586621681011197"><span class="hs-identifier hs-var">defss</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-567"></span><span>
</span><span id="line-568"></span><span class="hs-comment">-- | Here we take a global variable definition, rename it with a</span><span>
</span><span id="line-569"></span><span class="hs-comment">-- @$def@ suffix, and generate the appropriate alias.</span><span>
</span><span id="line-570"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#aliasify"><span class="hs-identifier hs-type">aliasify</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-type">LMGlobal</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#LlvmM"><span class="hs-identifier hs-type">LlvmM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-type">LMGlobal</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-571"></span><span class="hs-comment">-- See note [emit-time elimination of static indirections] in &quot;GHC.Cmm.CLabel&quot;.</span><span>
</span><span id="line-572"></span><span class="hs-comment">-- Here we obtain the indirectee's precise type and introduce</span><span>
</span><span id="line-573"></span><span class="hs-comment">-- fresh aliases to both the precise typed label (lbl$def) and the i8*</span><span>
</span><span id="line-574"></span><span class="hs-comment">-- typed (regular) label of it with the matching new names.</span><span>
</span><span id="line-575"></span><span id="aliasify"><span class="annot"><span class="annottext">aliasify :: LMGlobal -&gt; LlvmM [LMGlobal]
</span><a href="GHC.CmmToLlvm.Base.html#aliasify"><span class="hs-identifier hs-var hs-var">aliasify</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-type">LMGlobal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-type">LMGlobalVar</span></a></span><span> </span><span id="local-6989586621681011188"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011188"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681011187"><span class="annot"><span class="annottext">ty :: LlvmType
</span><a href="#local-6989586621681011187"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Llvm.Types.html#LMAlias"><span class="hs-identifier hs-type">LMAlias</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span id="local-6989586621681011185"><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011185"><span class="hs-identifier hs-var">link</span></a></span></span><span> </span><span id="local-6989586621681011184"><span class="annot"><span class="annottext">LMSection
</span><a href="#local-6989586621681011184"><span class="hs-identifier hs-var">sect</span></a></span></span><span> </span><span id="local-6989586621681011183"><span class="annot"><span class="annottext">LMAlign
</span><a href="#local-6989586621681011183"><span class="hs-identifier hs-var">align</span></a></span></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-576"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681011182"><span class="annot"><span class="annottext">LlvmStatic
</span><a href="#local-6989586621681011182"><span class="hs-identifier hs-var">orig</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-577"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011181"><span class="annot"><span class="annottext">defLbl :: LMString
</span><a href="#local-6989586621681011181"><span class="hs-identifier hs-var hs-var">defLbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LMString
</span><a href="GHC.CmmToLlvm.Base.html#llvmDefLabel"><span class="hs-identifier hs-var">llvmDefLabel</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011188"><span class="hs-identifier hs-var">lbl</span></a></span><span>
</span><span id="line-578"></span><span>        </span><span class="annot"><a href="GHC.Llvm.Types.html#LMStaticPointer"><span class="hs-identifier hs-type">LMStaticPointer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-type">LMGlobalVar</span></a></span><span> </span><span id="local-6989586621681011179"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011179"><span class="hs-identifier hs-var">origLbl</span></a></span></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681011178"><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011178"><span class="hs-identifier hs-var">oLnk</span></a></span></span><span> </span><span class="annot"><span class="annottext">LMSection
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmStatic
</span><a href="#local-6989586621681011182"><span class="hs-identifier hs-var">orig</span></a></span><span>
</span><span id="line-579"></span><span>        </span><span id="local-6989586621681011177"><span class="annot"><span class="annottext">defOrigLbl :: LMString
</span><a href="#local-6989586621681011177"><span class="hs-identifier hs-var hs-var">defOrigLbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LMString
</span><a href="GHC.CmmToLlvm.Base.html#llvmDefLabel"><span class="hs-identifier hs-var">llvmDefLabel</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011179"><span class="hs-identifier hs-var">origLbl</span></a></span><span>
</span><span id="line-580"></span><span>        </span><span id="local-6989586621681011176"><span class="annot"><span class="annottext">orig' :: LlvmStatic
</span><a href="#local-6989586621681011176"><span class="hs-identifier hs-var hs-var">orig'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmStatic
</span><a href="GHC.Llvm.Types.html#LMStaticPointer"><span class="hs-identifier hs-var">LMStaticPointer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011179"><span class="hs-identifier hs-var">origLbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011178"><span class="hs-identifier hs-var">oLnk</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-581"></span><span>    </span><span id="local-6989586621681011175"><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="#local-6989586621681011175"><span class="hs-identifier hs-var">origType</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LlvmM (Maybe LlvmType)
forall key. Uniquable key =&gt; key -&gt; LlvmM (Maybe LlvmType)
</span><a href="GHC.CmmToLlvm.Base.html#funLookup"><span class="hs-identifier hs-var">funLookup</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011179"><span class="hs-identifier hs-var">origLbl</span></a></span><span>
</span><span id="line-582"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681011172"><span class="annot"><span class="annottext">defOrig :: LlvmStatic
</span><a href="#local-6989586621681011172"><span class="hs-identifier hs-var hs-var">defOrig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmStatic -&gt; LlvmType -&gt; LlvmStatic
</span><a href="GHC.Llvm.Types.html#LMBitc"><span class="hs-identifier hs-var">LMBitc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmStatic
</span><a href="GHC.Llvm.Types.html#LMStaticPointer"><span class="hs-identifier hs-var">LMStaticPointer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011177"><span class="hs-identifier hs-var">defOrigLbl</span></a></span><span>
</span><span id="line-583"></span><span>                                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#pLift"><span class="hs-identifier hs-var">pLift</span></a></span><span> </span><span class="annot"><span class="annottext">(LlvmType -&gt; LlvmType) -&gt; LlvmType -&gt; LlvmType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LlvmType -&gt; LlvmType
forall a. HasCallStack =&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromJust"><span class="hs-identifier hs-var">fromJust</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LlvmType
</span><a href="#local-6989586621681011175"><span class="hs-identifier hs-var">origType</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011178"><span class="hs-identifier hs-var">oLnk</span></a></span><span>
</span><span id="line-584"></span><span>                                           </span><span class="annot"><span class="annottext">LMSection
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span>                         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#pLift"><span class="hs-identifier hs-var">pLift</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011187"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-586"></span><span>    </span><span class="annot"><span class="annottext">[LMGlobal] -&gt; LlvmM [LMGlobal]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; Maybe LlvmStatic -&gt; LMGlobal
</span><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-var">LMGlobal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011181"><span class="hs-identifier hs-var">defLbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011187"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011185"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
</span><a href="#local-6989586621681011184"><span class="hs-identifier hs-var">sect</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
</span><a href="#local-6989586621681011183"><span class="hs-identifier hs-var">align</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmStatic -&gt; Maybe LlvmStatic
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmStatic
</span><a href="#local-6989586621681011172"><span class="hs-identifier hs-var">defOrig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-587"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; Maybe LlvmStatic -&gt; LMGlobal
</span><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-var">LMGlobal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011188"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011185"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
</span><a href="#local-6989586621681011184"><span class="hs-identifier hs-var">sect</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
</span><a href="#local-6989586621681011183"><span class="hs-identifier hs-var">align</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmStatic -&gt; Maybe LlvmStatic
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmStatic
</span><a href="#local-6989586621681011176"><span class="hs-identifier hs-var">orig'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-588"></span><span>         </span><span class="hs-special">]</span><span>
</span><span id="line-589"></span><span class="annot"><a href="GHC.CmmToLlvm.Base.html#aliasify"><span class="hs-identifier hs-var">aliasify</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-type">LMGlobal</span></a></span><span> </span><span id="local-6989586621681011169"><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011169"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681011168"><span class="annot"><span class="annottext">Maybe LlvmStatic
</span><a href="#local-6989586621681011168"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-590"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-type">LMGlobalVar</span></a></span><span> </span><span id="local-6989586621681011167"><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011167"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681011166"><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011166"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681011165"><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011165"><span class="hs-identifier hs-var">link</span></a></span></span><span> </span><span id="local-6989586621681011164"><span class="annot"><span class="annottext">LMSection
</span><a href="#local-6989586621681011164"><span class="hs-identifier hs-var">sect</span></a></span></span><span> </span><span id="local-6989586621681011163"><span class="annot"><span class="annottext">LMAlign
</span><a href="#local-6989586621681011163"><span class="hs-identifier hs-var">align</span></a></span></span><span> </span><span id="local-6989586621681011162"><span class="annot"><span class="annottext">LMConst
</span><a href="#local-6989586621681011162"><span class="hs-identifier hs-var">const</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011169"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-591"></span><span>
</span><span id="line-592"></span><span>        </span><span id="local-6989586621681011161"><span class="annot"><span class="annottext">defLbl :: LMString
</span><a href="#local-6989586621681011161"><span class="hs-identifier hs-var hs-var">defLbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString -&gt; LMString
</span><a href="GHC.CmmToLlvm.Base.html#llvmDefLabel"><span class="hs-identifier hs-var">llvmDefLabel</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011167"><span class="hs-identifier hs-var">lbl</span></a></span><span>
</span><span id="line-593"></span><span>        </span><span id="local-6989586621681011160"><span class="annot"><span class="annottext">defVar :: LlvmVar
</span><a href="#local-6989586621681011160"><span class="hs-identifier hs-var hs-var">defVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011161"><span class="hs-identifier hs-var">defLbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011166"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="GHC.Llvm.Types.html#Internal"><span class="hs-identifier hs-var">Internal</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
</span><a href="#local-6989586621681011164"><span class="hs-identifier hs-var">sect</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
</span><a href="#local-6989586621681011163"><span class="hs-identifier hs-var">align</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="#local-6989586621681011162"><span class="hs-identifier hs-var">const</span></a></span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span>        </span><span id="local-6989586621681011158"><span class="annot"><span class="annottext">defPtrVar :: LlvmVar
</span><a href="#local-6989586621681011158"><span class="hs-identifier hs-var hs-var">defPtrVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011161"><span class="hs-identifier hs-var">defLbl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmType -&gt; LlvmType
</span><a href="GHC.Llvm.Types.html#LMPointer"><span class="hs-identifier hs-var">LMPointer</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="#local-6989586621681011166"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011165"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="#local-6989586621681011162"><span class="hs-identifier hs-var">const</span></a></span><span>
</span><span id="line-596"></span><span>        </span><span id="local-6989586621681011157"><span class="annot"><span class="annottext">aliasVar :: LlvmVar
</span><a href="#local-6989586621681011157"><span class="hs-identifier hs-var hs-var">aliasVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LMString
-&gt; LlvmType
-&gt; LlvmLinkageType
-&gt; LMSection
-&gt; LMAlign
-&gt; LMConst
-&gt; LlvmVar
</span><a href="GHC.Llvm.Types.html#LMGlobalVar"><span class="hs-identifier hs-var">LMGlobalVar</span></a></span><span> </span><span class="annot"><span class="annottext">LMString
</span><a href="#local-6989586621681011167"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmLinkageType
</span><a href="#local-6989586621681011165"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">LMSection
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMAlign
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">LMConst
</span><a href="GHC.Llvm.Types.html#Alias"><span class="hs-identifier hs-var">Alias</span></a></span><span>
</span><span id="line-597"></span><span>        </span><span id="local-6989586621681011156"><span class="annot"><span class="annottext">aliasVal :: LlvmStatic
</span><a href="#local-6989586621681011156"><span class="hs-identifier hs-var hs-var">aliasVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LlvmStatic -&gt; LlvmType -&gt; LlvmStatic
</span><a href="GHC.Llvm.Types.html#LMBitc"><span class="hs-identifier hs-var">LMBitc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmStatic
</span><a href="GHC.Llvm.Types.html#LMStaticPointer"><span class="hs-identifier hs-var">LMStaticPointer</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011158"><span class="hs-identifier hs-var">defPtrVar</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LlvmType
</span><a href="GHC.Llvm.Types.html#i8Ptr"><span class="hs-identifier hs-var">i8Ptr</span></a></span><span>
</span><span id="line-598"></span><span>
</span><span id="line-599"></span><span>    </span><span class="hs-comment">-- we need to mark the $def symbols as used so LLVM doesn't forget which</span><span>
</span><span id="line-600"></span><span>    </span><span class="hs-comment">-- section they need to go in. This will vanish once we switch away from</span><span>
</span><span id="line-601"></span><span>    </span><span class="hs-comment">-- mangling sections for TNTC.</span><span>
</span><span id="line-602"></span><span>    </span><span class="annot"><span class="annottext">LlvmVar -&gt; LlvmM ()
</span><a href="GHC.CmmToLlvm.Base.html#markUsedVar"><span class="hs-identifier hs-var">markUsedVar</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011160"><span class="hs-identifier hs-var">defVar</span></a></span><span>
</span><span id="line-603"></span><span>
</span><span id="line-604"></span><span>    </span><span class="annot"><span class="annottext">[LMGlobal] -&gt; LlvmM [LMGlobal]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; Maybe LlvmStatic -&gt; LMGlobal
</span><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-var">LMGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011160"><span class="hs-identifier hs-var">defVar</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe LlvmStatic
</span><a href="#local-6989586621681011168"><span class="hs-identifier hs-var">val</span></a></span><span>
</span><span id="line-605"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LlvmVar -&gt; Maybe LlvmStatic -&gt; LMGlobal
</span><a href="GHC.Llvm.Types.html#LMGlobal"><span class="hs-identifier hs-var">LMGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmVar
</span><a href="#local-6989586621681011157"><span class="hs-identifier hs-var">aliasVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LlvmStatic -&gt; Maybe LlvmStatic
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">LlvmStatic
</span><a href="#local-6989586621681011156"><span class="hs-identifier hs-var">aliasVal</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-606"></span><span>           </span><span class="hs-special">]</span><span>
</span><span id="line-607"></span><span>
</span><span id="line-608"></span><span class="hs-comment">-- Note [Llvm Forward References]</span><span>
</span><span id="line-609"></span><span class="hs-comment">--</span><span>
</span><span id="line-610"></span><span class="hs-comment">-- The issue here is that LLVM insists on being strongly typed at</span><span>
</span><span id="line-611"></span><span class="hs-comment">-- every corner, so the first time we mention something, we have to</span><span>
</span><span id="line-612"></span><span class="hs-comment">-- settle what type we assign to it. That makes things awkward, as Cmm</span><span>
</span><span id="line-613"></span><span class="hs-comment">-- will often reference things before their definition, and we have no</span><span>
</span><span id="line-614"></span><span class="hs-comment">-- idea what (LLVM) type it is going to be before that point.</span><span>
</span><span id="line-615"></span><span class="hs-comment">--</span><span>
</span><span id="line-616"></span><span class="hs-comment">-- Our work-around is to define &quot;aliases&quot; of a standard type (i8 *) in</span><span>
</span><span id="line-617"></span><span class="hs-comment">-- these kind of situations, which we later tell LLVM to be either</span><span>
</span><span id="line-618"></span><span class="hs-comment">-- references to their actual local definitions (involving a cast) or</span><span>
</span><span id="line-619"></span><span class="hs-comment">-- an external reference. This obviously only works for pointers.</span><span>
</span><span id="line-620"></span><span class="hs-comment">--</span><span>
</span><span id="line-621"></span><span class="hs-comment">-- In particular when we encounter a reference to a symbol in a chunk of</span><span>
</span><span id="line-622"></span><span class="hs-comment">-- C-- there are three possible scenarios,</span><span>
</span><span id="line-623"></span><span class="hs-comment">--</span><span>
</span><span id="line-624"></span><span class="hs-comment">--   1. We have already seen a definition for the referenced symbol. This</span><span>
</span><span id="line-625"></span><span class="hs-comment">--      means we already know its type.</span><span>
</span><span id="line-626"></span><span class="hs-comment">--</span><span>
</span><span id="line-627"></span><span class="hs-comment">--   2. We have not yet seen a definition but we will find one later in this</span><span>
</span><span id="line-628"></span><span class="hs-comment">--      compilation unit. Since we want to be a good consumer of the</span><span>
</span><span id="line-629"></span><span class="hs-comment">--      C-- streamed to us from upstream, we don't know the type of the</span><span>
</span><span id="line-630"></span><span class="hs-comment">--      symbol at the time when we must emit the reference.</span><span>
</span><span id="line-631"></span><span class="hs-comment">--</span><span>
</span><span id="line-632"></span><span class="hs-comment">--   3. We have not yet seen a definition nor will we find one in this</span><span>
</span><span id="line-633"></span><span class="hs-comment">--      compilation unit. In this case the reference refers to an</span><span>
</span><span id="line-634"></span><span class="hs-comment">--      external symbol for which we do not know the type.</span><span>
</span><span id="line-635"></span><span class="hs-comment">--</span><span>
</span><span id="line-636"></span><span class="hs-comment">-- Let's consider case (2) for a moment: say we see a reference to</span><span>
</span><span id="line-637"></span><span class="hs-comment">-- the symbol @fooBar@ for which we have not seen a definition. As we</span><span>
</span><span id="line-638"></span><span class="hs-comment">-- do not know the symbol's type, we assume it is of type @i8*@ and emit</span><span>
</span><span id="line-639"></span><span class="hs-comment">-- the appropriate casts in @getSymbolPtr@. Later on, when we</span><span>
</span><span id="line-640"></span><span class="hs-comment">-- encounter the definition of @fooBar@ we emit it but with a modified</span><span>
</span><span id="line-641"></span><span class="hs-comment">-- name, @fooBar$def@ (which we'll call the definition symbol), to</span><span>
</span><span id="line-642"></span><span class="hs-comment">-- since we have already had to assume that the symbol @fooBar@</span><span>
</span><span id="line-643"></span><span class="hs-comment">-- is of type @i8*@. We then emit @fooBar@ itself as an alias</span><span>
</span><span id="line-644"></span><span class="hs-comment">-- of @fooBar$def@ with appropriate casts. This all happens in</span><span>
</span><span id="line-645"></span><span class="hs-comment">-- @aliasify@.</span><span>
</span><span id="line-646"></span><span class="hs-comment">--</span><span>
</span><span id="line-647"></span><span class="hs-comment">-- Case (3) is quite similar to (2): References are emitted assuming</span><span>
</span><span id="line-648"></span><span class="hs-comment">-- the referenced symbol is of type @i8*@. When we arrive at the end of</span><span>
</span><span id="line-649"></span><span class="hs-comment">-- the compilation unit and realize that the symbol is external, we emit</span><span>
</span><span id="line-650"></span><span class="hs-comment">-- an LLVM @external global@ declaration for the symbol @fooBar@</span><span>
</span><span id="line-651"></span><span class="hs-comment">-- (handled in @generateExternDecls@). This takes advantage of the</span><span>
</span><span id="line-652"></span><span class="hs-comment">-- fact that the aliases produced by @aliasify@ for exported symbols</span><span>
</span><span id="line-653"></span><span class="hs-comment">-- have external linkage and can therefore be used as normal symbols.</span><span>
</span><span id="line-654"></span><span class="hs-comment">--</span><span>
</span><span id="line-655"></span><span class="hs-comment">-- Historical note: As of release 3.5 LLVM does not allow aliases to</span><span>
</span><span id="line-656"></span><span class="hs-comment">-- refer to declarations. This the reason why aliases are produced at the</span><span>
</span><span id="line-657"></span><span class="hs-comment">-- point of definition instead of the point of usage, as was previously</span><span>
</span><span id="line-658"></span><span class="hs-comment">-- done. See #9142 for details.</span><span>
</span><span id="line-659"></span><span class="hs-comment">--</span><span>
</span><span id="line-660"></span><span class="hs-comment">-- Finally, case (1) is trivial. As we already have a definition for</span><span>
</span><span id="line-661"></span><span class="hs-comment">-- and therefore know the type of the referenced symbol, we can do</span><span>
</span><span id="line-662"></span><span class="hs-comment">-- away with casting the alias to the desired type in @getSymbolPtr@</span><span>
</span><span id="line-663"></span><span class="hs-comment">-- and instead just emit a reference to the definition symbol directly.</span><span>
</span><span id="line-664"></span><span class="hs-comment">-- This is the @Just@ case in @getSymbolPtr@.</span><span>
</span><span id="line-665"></span></pre></body></html>